summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-02-22 07:23:30 +0000
committerPaul Smith <psmith@gnu.org>1999-02-22 07:23:30 +0000
commita66668aabccfbae3e1f22eaeb897b9c7a1e02733 (patch)
treefd4454775a6dcb2d0222f3e65c04f2011547b4ea /variable.c
parent84f38c9c6f56c7056a1d1a5abf9151bf15760151 (diff)
downloadgunmake-a66668aabccfbae3e1f22eaeb897b9c7a1e02733.tar.gz
* New feature: .LIBPATTERNS controls the way -lfoo dependencies are expanded.
* A few tweaks to the system glob test, after trying it on a system where it's true. * Installed patches to archive handling for AIX 4.3 big archives. * Fix a memory stomp in target-specific variables. * Fix a memory leak in foreach functions.
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/variable.c b/variable.c
index 85987db..648f82b 100644
--- a/variable.c
+++ b/variable.c
@@ -265,6 +265,8 @@ pop_variable_scope ()
next = v->next;
free (v->name);
+ if (v->value)
+ free (v->value);
free ((char *) v);
}
}
@@ -687,7 +689,7 @@ try_variable_definition (flocp, line, origin)
register char *end;
enum { f_bogus,
f_simple, f_recursive, f_append, f_conditional } flavor = f_bogus;
- char *name, *expanded_name, *value;
+ char *name, *expanded_name, *value, *alloc_value=NULL;
struct variable *v;
while (1)
@@ -775,8 +777,11 @@ try_variable_definition (flocp, line, origin)
/* Should not be possible. */
abort ();
case f_simple:
- /* A simple variable definition "var := value". Expand the value. */
- value = variable_expand (p);
+ /* A simple variable definition "var := value". Expand the value.
+ We have to allocate memory since otherwise it'll clobber the
+ variable buffer, and we still need that. */
+ alloc_value = allocated_variable_expand (p);
+ value = alloc_value;
break;
case f_conditional:
/* A conditional variable definition "var ?= value".
@@ -931,6 +936,8 @@ try_variable_definition (flocp, line, origin)
v = define_variable (expanded_name, strlen (expanded_name),
value, origin, flavor == f_recursive);
+ if (alloc_value)
+ free (alloc_value);
free (expanded_name);
return v;