diff options
author | 2011-05-18 12:55:03 +0300 | |
---|---|---|
committer | 2011-05-18 15:43:01 +0300 | |
commit | 8c2eecbbb064f86c1e81323dbfb6c315fc1b2631 (patch) | |
tree | fe883a7b7824af7f233c0b10bb58e1e8ac20c6ce /src | |
parent | multithread (diff) | |
download | libbash-8c2eecbbb064f86c1e81323dbfb6c315fc1b2631.tar.gz libbash-8c2eecbbb064f86c1e81323dbfb6c315fc1b2631.tar.bz2 libbash-8c2eecbbb064f86c1e81323dbfb6c315fc1b2631.zip |
Core: fix memory leak
bash_ast::interpret_with was leaking memory when return_exception was
thrown when interpreting.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/bash_ast.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/bash_ast.cpp b/src/core/bash_ast.cpp index 2f729a4..22c7f22 100644 --- a/src/core/bash_ast.cpp +++ b/src/core/bash_ast.cpp @@ -119,7 +119,15 @@ void bash_ast::interpret_with(interpreter& walker) auto nodes = antlr3CommonTreeNodeStreamNewTree(langAST->tree, ANTLR3_SIZE_HINT); plibbashWalker treePsr = libbashWalkerNew(nodes); - treePsr->start(treePsr); + try + { + treePsr->start(treePsr); + } + catch(...) + { + treePsr->free(treePsr); + throw; + } treePsr->free(treePsr); nodes->free(nodes); } |