From 59123c328345f434438eab69a00de1bb74045421 Mon Sep 17 00:00:00 2001 From: zhangyouyou Date: Wed, 9 Apr 2025 17:03:22 +0800 Subject: [PATCH] timer double free [Bug]: timer double free https://gitee.com/openharmony/commonlibrary_ets_utils/issues/IBYWO0 Signed-off-by: zhangyouyou --- js_sys_module/timer/sys_timer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js_sys_module/timer/sys_timer.cpp b/js_sys_module/timer/sys_timer.cpp index 802afcb1..364665fc 100755 --- a/js_sys_module/timer/sys_timer.cpp +++ b/js_sys_module/timer/sys_timer.cpp @@ -189,7 +189,10 @@ void Timer::TimerCallback(uv_timer_t* handle) napi_call_function(env, undefinedValue, callback, callbackInfo->argc_, callbackArgv, &callbackResult); - Helper::CloseHelp::DeletePointer(callbackArgv, true); + { + std::lock_guard lock(timeLock); + Helper::CloseHelp::DeletePointer(callbackArgv, true); + } if (Helper::NapiHelper::IsExceptionPending(env)) { HILOG_ERROR("Pending exception in TimerCallback. Triggering HandleUncaughtException"); reinterpret_cast(env)->HandleUncaughtException(); -- Gitee