From 0e9c66d97397ba53796449a76a93b5dbec67cc58 Mon Sep 17 00:00:00 2001 From: huangzhenghua Date: Thu, 29 Jun 2023 22:22:15 +0800 Subject: [PATCH] fix memleak of testcase issue: https://gitee.com/openharmony/xts_acts/issues/I7H5S9 Signed-off-by: huangzhenghua Change-Id: I262f92cd458068c52ed30bed69092f4aa5ab94ed --- arkui/ace_napi_test/entry/src/main/cpp/napi/napi_test.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arkui/ace_napi_test/entry/src/main/cpp/napi/napi_test.cpp b/arkui/ace_napi_test/entry/src/main/cpp/napi/napi_test.cpp index 77fd66c87..7ac8a56f0 100644 --- a/arkui/ace_napi_test/entry/src/main/cpp/napi/napi_test.cpp +++ b/arkui/ace_napi_test/entry/src/main/cpp/napi/napi_test.cpp @@ -1997,12 +1997,9 @@ static napi_value napiCancelAsyncWork(napi_env env, napi_callback_info info) napi_value resourceName = nullptr; napi_create_string_utf8(env, "AsyncWorkTest", NAPI_AUTO_LENGTH, &resourceName); napi_create_async_work(env, nullptr, resourceName, [](napi_env value, void* data) {}, - [](napi_env env, napi_status status, void* data) { - napi_async_work workData = (napi_async_work)data; - napi_delete_async_work(env, workData); - }, work, &work); - napi_queue_async_work(env, work); + [](napi_env env, napi_status status, void* data) {}, nullptr, &work); NAPI_CALL(env, napi_cancel_async_work(env, work)); + napi_delete_async_work(env, work); napi_value value; NAPI_CALL(env, napi_create_int32(env, 0, &value)); -- GitLab