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:
parent
4697e1b0d7
commit
e029bc94e6
@ -760,6 +760,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
|
|||||||
HandleScope handle_scope(isolate);
|
HandleScope handle_scope(isolate);
|
||||||
Local<Context> context = NewContext(isolate);
|
Local<Context> context = NewContext(isolate);
|
||||||
Context::Scope context_scope(context);
|
Context::Scope context_scope(context);
|
||||||
|
int exit_code = 0;
|
||||||
Environment env(
|
Environment env(
|
||||||
isolate_data,
|
isolate_data,
|
||||||
context,
|
context,
|
||||||
@ -780,7 +781,8 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
|
|||||||
true);
|
true);
|
||||||
if (env.options()->debug_options().inspector_enabled &&
|
if (env.options()->debug_options().inspector_enabled &&
|
||||||
!env.inspector_agent()->IsListening()) {
|
!env.inspector_agent()->IsListening()) {
|
||||||
return 12; // Signal internal error.
|
exit_code = 12; // Signal internal error.
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// inspector_enabled can't be true if !HAVE_INSPECTOR or !NODE_USE_V8_PLATFORM
|
// 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);
|
env.set_trace_sync_io(false);
|
||||||
|
|
||||||
const int exit_code = EmitExit(&env);
|
exit_code = EmitExit(&env);
|
||||||
|
|
||||||
WaitForInspectorDisconnect(&env);
|
WaitForInspectorDisconnect(&env);
|
||||||
|
|
||||||
|
exit:
|
||||||
env.set_can_call_into_js(false);
|
env.set_can_call_into_js(false);
|
||||||
env.stop_sub_worker_contexts();
|
env.stop_sub_worker_contexts();
|
||||||
uv_tty_reset_mode();
|
uv_tty_reset_mode();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user