summaryrefslogtreecommitdiff
path: root/src/expr/symbol_table.cpp
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2017-07-30 10:38:06 -0700
committerGitHub <noreply@github.com>2017-07-30 10:38:06 -0700
commit1307691a6306e84efb4e194755bb111fa0843dd4 (patch)
tree9797878a0edd8ac746b5bb49d90a284835df4c49 /src/expr/symbol_table.cpp
parentcc4323cf943a0d146a307ecb103544732c76e824 (diff)
Fix memory leak in symbol table (#209)
Commit 4cab39bd4f166716cd3d357a175c346afb838137 moved d_exprMap, d_typeMap, and d_functions into SymbolTable::Implementation but did not move the deletion of those objects from SymbolTable to the SymbolTable::Implementation desconstructor, resulting in a memory leak. This commit fixes the issue.
Diffstat (limited to 'src/expr/symbol_table.cpp')
-rw-r--r--src/expr/symbol_table.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/expr/symbol_table.cpp b/src/expr/symbol_table.cpp
index ba731ec1e..c760b3a80 100644
--- a/src/expr/symbol_table.cpp
+++ b/src/expr/symbol_table.cpp
@@ -49,6 +49,12 @@ class SymbolTable::Implementation {
d_typeMap(new (true) TypeMap(&d_context)),
d_functions(new (true) CDHashSet<Expr, ExprHashFunction>(&d_context)) {}
+ ~Implementation() {
+ d_exprMap->deleteSelf();
+ d_typeMap->deleteSelf();
+ d_functions->deleteSelf();
+ }
+
void bind(const string& name, Expr obj, bool levelZero) throw();
void bindDefinedFunction(const string& name, Expr obj,
bool levelZero) throw();
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback