diff options
author | Paul Smith <psmith@gnu.org> | 2006-02-14 15:42:17 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2006-02-14 15:42:17 +0000 |
commit | 86af3872a910e314d20ef911fad1819ad90c1291 (patch) | |
tree | ca807059149cdac8be7461efa747b41505b36513 /variable.c | |
parent | df267b31c5dbe4d9fe774c63acc31ef0b804f902 (diff) | |
download | gunmake-86af3872a910e314d20ef911fad1819ad90c1291.tar.gz |
Some memory leak cleanups (found with valgrind).
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -539,14 +539,6 @@ initialize_file_variables (struct file *file, int reading) /* Pop the top set off the current variable set list, and free all its storage. */ -static void -free_variable_name_and_value (const void *item) -{ - struct variable *v = (struct variable *) item; - free (v->name); - free (v->value); -} - struct variable_set_list * create_new_variable_set (void) { @@ -565,6 +557,23 @@ create_new_variable_set (void) return setlist; } +static void +free_variable_name_and_value (const void *item) +{ + struct variable *v = (struct variable *) item; + free (v->name); + free (v->value); +} + +void +free_variable_set (struct variable_set_list *list) +{ + hash_map (&list->set->table, free_variable_name_and_value); + hash_free (&list->set->table, 1); + free ((char *) list->set); + free ((char *) list); +} + /* Create a new variable set and push it on the current setlist. If we're pushing a global scope (that is, the current scope is the global scope) then we need to "push" it the other way: file variable sets point |