diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 70c63a0d8a3ec1..a13eed9d0ffdeb 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -260,11 +260,14 @@ void ContextifyContext::MakeContext(const FunctionCallbackInfo& 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(),