Skip to content

Commit 9a5cec3

Browse files
committed
src: fix memory leak in CreateEnvironment when bootstrap fails
Backport-PR-URL: #35241 PR-URL: #30467 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
1 parent 7d92ac7 commit 9a5cec3

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
@@ -336,8 +336,10 @@ Environment* CreateEnvironment(IsolateData* isolate_data,
336336
Environment::kOwnsProcessState |
337337
Environment::kOwnsInspector));
338338
env->InitializeLibuv(per_process::v8_is_profiling);
339-
if (env->RunBootstrapping().IsEmpty())
339+
if (env->RunBootstrapping().IsEmpty()) {
340+
FreeEnvironment(env);
340341
return nullptr;
342+
}
341343
return env;
342344
}
343345

0 commit comments

Comments
 (0)