mirror of
https://salsa.debian.org/srivasta/make-dfsg.git
synced 2025-02-06 20:42:58 +00:00
(read_makefile): Free FILENAME if we allocated it. From Jim Meyering.
This commit is contained in:
parent
c1f2ef6d09
commit
90dffad2cc
1 changed files with 3 additions and 1 deletions
4
read.c
4
read.c
|
@ -240,6 +240,7 @@ read_makefile (filename, flags)
|
||||||
char *p2;
|
char *p2;
|
||||||
int ignoring = 0, in_ignored_define = 0;
|
int ignoring = 0, in_ignored_define = 0;
|
||||||
int no_targets = 0; /* Set when reading a rule without targets. */
|
int no_targets = 0; /* Set when reading a rule without targets. */
|
||||||
|
char *passed_filename = filename;
|
||||||
|
|
||||||
struct nameseq *filenames = 0;
|
struct nameseq *filenames = 0;
|
||||||
struct dep *deps;
|
struct dep *deps;
|
||||||
|
@ -288,7 +289,6 @@ read_makefile (filename, flags)
|
||||||
if (!(flags & RM_NO_TILDE) && filename[0] == '~')
|
if (!(flags & RM_NO_TILDE) && filename[0] == '~')
|
||||||
{
|
{
|
||||||
char *expanded = tilde_expand (filename);
|
char *expanded = tilde_expand (filename);
|
||||||
/* This is a possible memory leak, but I don't care. */
|
|
||||||
if (expanded != 0)
|
if (expanded != 0)
|
||||||
filename = expanded;
|
filename = expanded;
|
||||||
}
|
}
|
||||||
|
@ -330,6 +330,8 @@ read_makefile (filename, flags)
|
||||||
if (flags & RM_DONTCARE)
|
if (flags & RM_DONTCARE)
|
||||||
deps->file->dontcare = 1;
|
deps->file->dontcare = 1;
|
||||||
}
|
}
|
||||||
|
if (filename != passed_filename)
|
||||||
|
free (filename);
|
||||||
filename = deps->file->name;
|
filename = deps->file->name;
|
||||||
deps->changed = flags;
|
deps->changed = flags;
|
||||||
deps = 0;
|
deps = 0;
|
||||||
|
|
Loading…
Reference in a new issue