summaryrefslogtreecommitdiff
path: root/src/node.cc
diff options
context:
space:
mode:
authorGireesh Punathil <gpunathi@in.ibm.com>2019-03-06 09:28:34 -0500
committerGireesh Punathil <gpunathi@in.ibm.com>2019-03-08 18:19:35 +0530
commite029bc94e6404ac79cf304abbbd43325d407f668 (patch)
treed48c6c0391a3c951b81d6d0959f564cd0dfd5100 /src/node.cc
parent4697e1b0d792f50863bbbcad25a95b84e6746501 (diff)
downloadandroid-node-v8-e029bc94e6404ac79cf304abbbd43325d407f668.tar.gz
android-node-v8-e029bc94e6404ac79cf304abbbd43325d407f668.tar.bz2
android-node-v8-e029bc94e6404ac79cf304abbbd43325d407f668.zip
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>
Diffstat (limited to 'src/node.cc')
-rw-r--r--src/node.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/node.cc b/src/node.cc
index f55c1df4e8..4def46ee16 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -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();