Module Name: src
Committed By: rillig
Date: Sun Oct 4 21:41:44 UTC 2020
Modified Files:
src/usr.bin/make: parse.c
Log Message:
make(1): rename local variable in VarAssign_Eval
The value to be freed is not always evalue. In the case of VAR_SUBST,
it will be the output of the command, not the command itself.
To generate a diff of this commit:
cvs rdiff -u -r1.360 -r1.361 src/usr.bin/make/parse.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.360 src/usr.bin/make/parse.c:1.361
--- src/usr.bin/make/parse.c:1.360 Sun Oct 4 21:08:37 2020
+++ src/usr.bin/make/parse.c Sun Oct 4 21:41:44 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.360 2020/10/04 21:08:37 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.361 2020/10/04 21:41:44 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.360 2020/10/04 21:08:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.361 2020/10/04 21:41:44 rillig Exp $");
/* types and constants */
@@ -1814,11 +1814,12 @@ VarAssign_Eval(VarAssign *var, GNode *ct
const char *name = var->varname;
const VarAssignOp type = var->op;
const char *avalue = uvalue;
- char *evalue = NULL;
+ void *avalue_freeIt = NULL;
if (type == VAR_APPEND) {
Var_Append(name, uvalue, ctxt);
} else if (type == VAR_SUBST) {
+ char *evalue;
/*
* Allow variables in the old value to be undefined, but leave their
* expressions alone -- this is done by forcing oldVars to be false.
@@ -1845,6 +1846,7 @@ VarAssign_Eval(VarAssign *var, GNode *ct
/* TODO: handle errors */
oldVars = oldOldVars;
avalue = evalue;
+ avalue_freeIt = evalue;
Var_Set(name, avalue, ctxt);
} else if (type == VAR_SHELL) {
@@ -1852,6 +1854,7 @@ VarAssign_Eval(VarAssign *var, GNode *ct
const char *error;
if (strchr(uvalue, '$') != NULL) {
+ char *evalue;
/*
* There's a dollar sign in the command, so perform variable
* expansion on the whole thing. The resulting string will need
@@ -1861,6 +1864,7 @@ VarAssign_Eval(VarAssign *var, GNode *ct
&evalue);
/* TODO: handle errors */
avalue = evalue;
+ avalue_freeIt = evalue;
}
res = Cmd_Exec(avalue, &error);
@@ -1880,7 +1884,7 @@ VarAssign_Eval(VarAssign *var, GNode *ct
}
*out_avalue = avalue;
- *out_avalue_freeIt = evalue;
+ *out_avalue_freeIt = avalue_freeIt;
return TRUE;
}