summaryrefslogtreecommitdiff
path: root/rule.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-07-20 22:34:41 +0000
committerPaul Smith <psmith@gnu.org>1999-07-20 22:34:41 +0000
commit73846549f62b832ca6ff761ad3640a86d3b32c86 (patch)
tree040672d69082d86fe744ca7157bee5b72147f511 /rule.c
parent169e6b8c3de0145c61ff2127b7c191d12f069d2b (diff)
downloadgunmake-73846549f62b832ca6ff761ad3640a86d3b32c86.tar.gz
* Fix memory leaks, fd leaks, and some long-standing bugs recognizing when
targets need to have their modtimes rechecked (-n, etc.)
Diffstat (limited to 'rule.c')
-rw-r--r--rule.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/rule.c b/rule.c
index 08ab640..b813fa0 100644
--- a/rule.c
+++ b/rule.c
@@ -439,10 +439,23 @@ freerule (rule, lastrule)
{
struct rule *next = rule->next;
register unsigned int i;
+ register struct dep *dep;
for (i = 0; rule->targets[i] != 0; ++i)
free (rule->targets[i]);
+ dep = rule->deps;
+ while (dep)
+ {
+ struct dep *t;
+
+ t = dep->next;
+ /* We might leak dep->name here, but I'm not sure how to fix this: I
+ think that pointer might be shared (e.g., in the file hash?) */
+ free ((char *) dep);
+ dep = t;
+ }
+
free ((char *) rule->targets);
free ((char *) rule->suffixes);
free ((char *) rule->lens);