diff options
author | 2011-06-20 19:05:33 +0000 | |
---|---|---|
committer | 2011-06-20 19:05:33 +0000 | |
commit | 7739c128b1090a2d7747f1e57c5aa0419da5b947 (patch) | |
tree | c44f5a628f81d41e42bb2fa59f5bbbf80fc7b826 | |
parent | More cleanup in pf_test/pf_test6 this time mostly the fragment (diff) | |
download | wireguard-openbsd-7739c128b1090a2d7747f1e57c5aa0419da5b947.tar.xz wireguard-openbsd-7739c128b1090a2d7747f1e57c5aa0419da5b947.zip |
fix a segfault found by jasper@
ok miod@, otto@, jasper@
-rw-r--r-- | usr.bin/make/var.c | 13 |
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; } |