summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1994-07-25 22:07:41 +0000
committerRoland McGrath <roland@redhat.com>1994-07-25 22:07:41 +0000
commit90dffad2cce31e3f83ecac11ebe4b7b5bfd857ca (patch)
treea2b90acc2cd858576990c516258f08df31dabc1d
parentc1f2ef6d0936d6af1467abaabb06ae5f7488b72b (diff)
downloadgunmake-90dffad2cce31e3f83ecac11ebe4b7b5bfd857ca.tar.gz
(read_makefile): Free FILENAME if we allocated it. From Jim Meyering.
-rw-r--r--read.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/read.c b/read.c
index 6b7d122..6787d14 100644
--- a/read.c
+++ b/read.c
@@ -240,6 +240,7 @@ read_makefile (filename, flags)
char *p2;
int ignoring = 0, in_ignored_define = 0;
int no_targets = 0; /* Set when reading a rule without targets. */
+ char *passed_filename = filename;
struct nameseq *filenames = 0;
struct dep *deps;
@@ -288,7 +289,6 @@ read_makefile (filename, flags)
if (!(flags & RM_NO_TILDE) && filename[0] == '~')
{
char *expanded = tilde_expand (filename);
- /* This is a possible memory leak, but I don't care. */
if (expanded != 0)
filename = expanded;
}
@@ -330,6 +330,8 @@ read_makefile (filename, flags)
if (flags & RM_DONTCARE)
deps->file->dontcare = 1;
}
+ if (filename != passed_filename)
+ free (filename);
filename = deps->file->name;
deps->changed = flags;
deps = 0;