summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2012-09-09 21:56:55 +0000
committerPaul Smith <psmith@gnu.org>2012-09-09 21:56:55 +0000
commita839588fc940a359603dcca47adde5c97fb39aa9 (patch)
treebadd1a144c15e01c117cf4f56a5047b1cc29fc5b
parent8a0d46468ab12ee2ba920657ac1e76e2946acea2 (diff)
downloadmake-a839588fc940a359603dcca47adde5c97fb39aa9.tar.gz
Save the variable buffer content, not a potentially old pointer to it.
Fixes Savannah bug #36925.
-rw-r--r--ChangeLog3
-rw-r--r--file.c5
2 files changed, 5 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 261be30..943552e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2012-09-09 Paul Smith <psmith@gnu.org>
+ * file.c (expand_deps): Duplicate the current variable buffer, not
+ the old pointer. Fixes Savannah bug #36925.
+
* read.c (eval): If we detect an initial UTF-8 BOM, skip it.
Fixes Savannah bug #36529.
(record_target_var): Remove unused variable "fname".
diff --git a/file.c b/file.c
index 21582e0..896f7e2 100644
--- a/file.c
+++ b/file.c
@@ -573,12 +573,11 @@ expand_deps (struct file *f)
"$*" so they'll expand properly. */
if (d->staticpattern)
{
- char *o;
- d->name = o = variable_expand ("");
+ char *o = variable_expand ("");
o = subst_expand (o, name, "%", "$*", 1, 2, 0);
*o = '\0';
free (name);
- d->name = name = xstrdup (d->name);
+ d->name = name = xstrdup (variable_buffer);
d->staticpattern = 0;
}