summaryrefslogtreecommitdiff
path: root/read.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2006-02-14 15:42:17 +0000
committerPaul Smith <psmith@gnu.org>2006-02-14 15:42:17 +0000
commit86af3872a910e314d20ef911fad1819ad90c1291 (patch)
treeca807059149cdac8be7461efa747b41505b36513 /read.c
parentdf267b31c5dbe4d9fe774c63acc31ef0b804f902 (diff)
downloadgunmake-86af3872a910e314d20ef911fad1819ad90c1291.tar.gz
Some memory leak cleanups (found with valgrind).
Diffstat (limited to 'read.c')
-rw-r--r--read.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/read.c b/read.c
index 82bc253..0c78c7f 100644
--- a/read.c
+++ b/read.c
@@ -186,10 +186,7 @@ read_all_makefiles (char **makefiles)
{
if (*p != '\0')
*p++ = '\0';
- name = xstrdup (name);
- if (eval_makefile (name,
- RM_NO_DEFAULT_GOAL|RM_INCLUDED|RM_DONTCARE) < 2)
- free (name);
+ eval_makefile (name, RM_NO_DEFAULT_GOAL|RM_INCLUDED|RM_DONTCARE);
}
free (value);
@@ -810,7 +807,10 @@ eval (struct ebuffer *ebuf, int set_default)
/* If no filenames, it's a no-op. */
if (*p == '\0')
- continue;
+ {
+ free (p);
+ continue;
+ }
/* Parse the list of file names. */
p2 = p;
@@ -840,12 +840,9 @@ eval (struct ebuffer *ebuf, int set_default)
r = eval_makefile (name, (RM_INCLUDED | RM_NO_TILDE
| (noerror ? RM_DONTCARE : 0)));
- if (!r)
- {
- if (!noerror)
- error (fstart, "%s: %s", name, strerror (errno));
- free (name);
- }
+ if (!r && !noerror)
+ error (fstart, "%s: %s", name, strerror (errno));
+ free (name);
}
/* Restore conditional state. */