From 20d099af7a1fc103ecfb9a4afe59fd2fdcbe7802 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 27 Jun 2019 17:36:56 +0100 Subject: [PATCH] src: fix small memory leak PR-URL: https://github.com/nodejs/node/pull/28452 Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: James M Snell --- src/node_contextify.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(),