summaryrefslogtreecommitdiffstats
path: root/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-04-22 17:59:52 -0400
committerTavian Barnes <tavianator@gmail.com>2011-04-22 17:59:52 -0400
commit4e3c3918450d004bc00de4ad58eb7b707156f9aa (patch)
treeb243291c7c8f0ff1ad8977f9e44dbd13e56ba9ed /dimension
parent68e39815977c406b8ec39ee3e2fe975087b66303 (diff)
downloaddimension-4e3c3918450d004bc00de4ad58eb7b707156f9aa.tar.xz
Fix memory leak on #local redeclarations.
Diffstat (limited to 'dimension')
-rw-r--r--dimension/parse.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/dimension/parse.c b/dimension/parse.c
index 99cda05..74075a7 100644
--- a/dimension/parse.c
+++ b/dimension/parse.c
@@ -76,7 +76,13 @@ void dmnsn_local_symbol(dmnsn_symbol_table *symtable,
dmnsn_dictionary *dict;
dmnsn_array_get(symtable, dmnsn_array_size(symtable) - 1, &dict);
- dmnsn_dictionary_insert(dict, id, &value);
+ dmnsn_astnode *node = dmnsn_dictionary_at(dict, id);
+ if (node) {
+ dmnsn_delete_astnode(*node);
+ *node = value;
+ } else {
+ dmnsn_dictionary_insert(dict, id, &value);
+ }
}
void