mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
src: cleanup in all return paths in node::Start
`node::Start` creates a number of artifacts in its scope which are cleaned up in the exit path, but there is at least one path where the cleanups are bypassed. Force all paths follow the exit sequence. Refs: https://github.com/nodejs/node/pull/21283 PR-URL: https://github.com/nodejs/node/pull/26471 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
@@ -760,6 +760,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
|
||||
HandleScope handle_scope(isolate);
|
||||
Local<Context> context = NewContext(isolate);
|
||||
Context::Scope context_scope(context);
|
||||
int exit_code = 0;
|
||||
Environment env(
|
||||
isolate_data,
|
||||
context,
|
||||
@@ -780,7 +781,8 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
|
||||
true);
|
||||
if (env.options()->debug_options().inspector_enabled &&
|
||||
!env.inspector_agent()->IsListening()) {
|
||||
return 12; // Signal internal error.
|
||||
exit_code = 12; // Signal internal error.
|
||||
goto exit;
|
||||
}
|
||||
#else
|
||||
// inspector_enabled can't be true if !HAVE_INSPECTOR or !NODE_USE_V8_PLATFORM
|
||||
@@ -821,10 +823,11 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
|
||||
|
||||
env.set_trace_sync_io(false);
|
||||
|
||||
const int exit_code = EmitExit(&env);
|
||||
exit_code = EmitExit(&env);
|
||||
|
||||
WaitForInspectorDisconnect(&env);
|
||||
|
||||
exit:
|
||||
env.set_can_call_into_js(false);
|
||||
env.stop_sub_worker_contexts();
|
||||
uv_tty_reset_mode();
|
||||
|
||||
Reference in New Issue
Block a user