mirror of
https://github.com/openharmony/js_worker_module.git
synced 2026-07-19 19:23:34 -04:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user