summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-11-11 12:29:07 +0000
committerAnna Henningsen <anna@addaleax.net>2020-03-21 10:57:12 +0100
commit288382a4ce4c1eb5d6eaccf698099804f6a3697d (patch)
treefa1f2eaf4f47d8e2381f26d3dba36c169ba7ffe5 /src/api
parentd7bc5816a5d88e18d7ede081042d87f48a2bc54b (diff)
downloadnode-new-288382a4ce4c1eb5d6eaccf698099804f6a3697d.tar.gz
src: fix memory leak in CreateEnvironment when bootstrap fails
PR-URL: https://github.com/nodejs/node/pull/30467 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'src/api')
-rw-r--r--src/api/environment.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 02e9991e15..23bae50d6d 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -349,8 +349,10 @@ Environment* CreateEnvironment(IsolateData* isolate_data,
Environment::kOwnsProcessState |
Environment::kOwnsInspector));
env->InitializeLibuv(per_process::v8_is_profiling);
- if (env->RunBootstrapping().IsEmpty())
+ if (env->RunBootstrapping().IsEmpty()) {
+ FreeEnvironment(env);
return nullptr;
+ }
return env;
}