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>
This commit is contained in:
David Carlier 2019-06-27 17:36:56 +01:00 committed by Rich Trott
parent 4565292a77
commit 20d099af7a

View File

@ -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(),