Skip to content

Commit

Permalink
src: fix small memory leak
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
devnexen authored and Trott committed Jun 30, 2019
1 parent 4565292 commit 20d099a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/node_contextify.cc
Expand Up @@ -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(),
Expand Down

0 comments on commit 20d099a

Please sign in to comment.