aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPetteri Räty <petsku@petteriraty.eu>2011-05-18 12:55:03 +0300
committerPetteri Räty <petsku@petteriraty.eu>2011-05-18 15:43:01 +0300
commit8c2eecbbb064f86c1e81323dbfb6c315fc1b2631 (patch)
treefe883a7b7824af7f233c0b10bb58e1e8ac20c6ce /src
parentmultithread (diff)
downloadlibbash-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.cpp10
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);
}