Resolve the memory leak of StartExecuteInThread!

When loop is determined to be null, the script pointer
variable needs to be released.

Signed-off-by: duwenbo <duwenbo7@huawei.com>
This commit is contained in:
duwenbo
2022-02-21 18:32:08 +08:00
parent e8284c73d6
commit 803cba8e35
+1
View File
@@ -31,6 +31,7 @@ void Worker::StartExecuteInThread(napi_env env, const char* script)
uv_loop_t* loop = engine->GetUVLoop();
if (loop == nullptr) {
napi_throw_error(env, nullptr, "worker::engine loop is null");
CloseHelp::DeletePointer(script, true);
return;
}
uv_async_init(loop, &hostOnMessageSignal_, reinterpret_cast<uv_async_cb>(Worker::HostOnMessage));