summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2011-06-20 19:05:34 +0000
committerMarc Espie <espie@cvs.openbsd.org>2011-06-20 19:05:34 +0000
commit1997f5089949283305da3e710ffc85a38883e10f (patch)
tree7cd1c6e0520ba24d0b78c6c5f876416cfadc1f25 /usr.bin/make
parent470cedd8d8d42eb797784ad56673f198057a64d0 (diff)
fix a segfault found by jasper@
ok miod@, otto@, jasper@
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/var.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index da78bc9f280..1999478a431 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: var.c,v 1.87 2010/07/19 19:46:44 espie Exp $ */
+/* $OpenBSD: var.c,v 1.88 2011/06/20 19:05:33 espie Exp $ */
/* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */
/*
@@ -790,10 +790,15 @@ Var_ParseSkip(const char **pstr, SymTable *ctxt)
has_modifier = parse_base_variable_name(&tstr, &name, ctxt);
VarName_Free(&name);
result = true;
- if (has_modifier)
- if (VarModifiers_Apply(NULL, NULL, ctxt, true, NULL, &tstr,
- str[1]) == var_Error)
+ if (has_modifier) {
+ bool freePtr = false;
+ char *s = VarModifiers_Apply(NULL, NULL, ctxt, true, &freePtr,
+ &tstr, str[1]);
+ if (s == var_Error)
result = false;
+ if (freePtr)
+ free(s);
+ }
*pstr = tstr;
return result;
}