summaryrefslogtreecommitdiff
path: root/src/node_contextify.cc
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2019-06-27 17:36:56 +0100
committerRich Trott <rtrott@gmail.com>2019-06-30 14:31:10 -0700
commit20d099af7a1fc103ecfb9a4afe59fd2fdcbe7802 (patch)
treec789f1eb6f39e95a631dd84d15028b36a3549c62 /src/node_contextify.cc
parent4565292a771249e0bea3e8b1a69c5c6a7549fffa (diff)
downloadandroid-node-v8-20d099af7a1fc103ecfb9a4afe59fd2fdcbe7802.tar.gz
android-node-v8-20d099af7a1fc103ecfb9a4afe59fd2fdcbe7802.tar.bz2
android-node-v8-20d099af7a1fc103ecfb9a4afe59fd2fdcbe7802.zip
src: fix small memory leak
PR-URL: https://github.com/nodejs/node/pull/28452 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_contextify.cc')
-rw-r--r--src/node_contextify.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 70c63a0d8a..a13eed9d0f 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -260,11 +260,14 @@ void ContextifyContext::MakeContext(const FunctionCallbackInfo<Value>& args) {
if (try_catch.HasCaught()) {
if (!try_catch.HasTerminated())
try_catch.ReThrow();
+ delete context;
return;
}
- if (context->context().IsEmpty())
+ if (context->context().IsEmpty()) {
+ delete context;
return;
+ }
sandbox->SetPrivate(
env->context(),