From 1307691a6306e84efb4e194755bb111fa0843dd4 Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Sun, 30 Jul 2017 10:38:06 -0700 Subject: [PATCH] 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. --- src/expr/symbol_table.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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(&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(); -- 2.30.2