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 targos committed Jul 2, 2019
1 parent c9a96ae commit 624fd17
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/node_contextify.cc
Original file line number Diff line number Diff line change
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 624fd17

Please sign in to comment.