src: fix abort on uv_loop_init() failure

Fixes: https://github.com/nodejs/node/issues/34855

PR-URL: https://github.com/nodejs/node/pull/34874
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Ben Noordhuis authored and Anna Henningsen committed 2020-09-22 19:56:03 +02:00
1 parent d953fa3038
commit 26a596bf29
1 file changed
+9 -1
+9 -1
View File
@@ -457,9 +457,17 @@ Maybe<bool> SyncProcessRunner::TryInitializeAndRunLoop(Local<Value> options) {
SetError(UV_ENOMEM);
return Just(false);
}
CHECK_EQ(uv_loop_init(uv_loop_), 0);
r = uv_loop_init(uv_loop_);
if (r < 0) {
delete uv_loop_;
uv_loop_ = nullptr;
SetError(r);
return Just(false);
}
if (!ParseOptions(options).To(&r)) return Nothing<bool>();
if (r < 0) {
SetError(r);
return Just(false);