summaryrefslogtreecommitdiff
path: root/src/node_script.cc
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-02-24 15:19:12 -0800
committerRyan Dahl <ry@tinyclouds.org>2011-02-24 15:46:55 -0800
commit1f50d711b25c15228b4c85da0e44075239e17e68 (patch)
tree901607c7dda9d322f81107d4acbf8e6e99c42ab9 /src/node_script.cc
parentdf15472d3476737cd90fd8d74d32b0da8c544f9f (diff)
downloadnode-new-1f50d711b25c15228b4c85da0e44075239e17e68.tar.gz
Fix memleak in vm.runInNewContext
Closes GH-704.
Diffstat (limited to 'src/node_script.cc')
-rw-r--r--src/node_script.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/node_script.cc b/src/node_script.cc
index 609b616622..279d26f405 100644
--- a/src/node_script.cc
+++ b/src/node_script.cc
@@ -355,7 +355,14 @@ Handle<Value> WrappedScript::EvalMachine(const Arguments& args) {
if (output_flag == returnResult) {
result = script->Run();
- if (result.IsEmpty()) return try_catch.ReThrow();
+ if (result.IsEmpty()) {
+ if (context_flag == newContext) {
+ context->DetachGlobal();
+ context->Exit();
+ context.Dispose();
+ }
+ return try_catch.ReThrow();
+ }
} else {
WrappedScript *n_script = ObjectWrap::Unwrap<WrappedScript>(args.Holder());
if (!n_script) {