Skip to content

Commit 288382a

Browse files
committed
src: fix memory leak in CreateEnvironment when bootstrap fails
PR-URL: #30467 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent d7bc581 commit 288382a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/api/environment.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,10 @@ Environment* CreateEnvironment(IsolateData* isolate_data,
349349
Environment::kOwnsProcessState |
350350
Environment::kOwnsInspector));
351351
env->InitializeLibuv(per_process::v8_is_profiling);
352-
if (env->RunBootstrapping().IsEmpty())
352+
if (env->RunBootstrapping().IsEmpty()) {
353+
FreeEnvironment(env);
353354
return nullptr;
355+
}
354356
return env;
355357
}
356358

0 commit comments

Comments
 (0)