From e8744d8779b21fed0f5b872b2bc8d2a5fae8bc4c Mon Sep 17 00:00:00 2001 From: vadzz Date: Mon, 16 Dec 2024 13:46:44 +0300 Subject: [PATCH] Fix js-module timers leak --- shared/V8ResourceImpl.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/shared/V8ResourceImpl.cpp b/shared/V8ResourceImpl.cpp index e11af602..3428617b 100644 --- a/shared/V8ResourceImpl.cpp +++ b/shared/V8ResourceImpl.cpp @@ -77,7 +77,16 @@ void V8ResourceImpl::OnTick() for(auto& nextTickCb : nextTickCallbacks) nextTickCb(); nextTickCallbacks.clear(); - for(auto& id : oldTimers) timers.erase(id); + for(auto& id : oldTimers) + { + auto it = timers.find(id); + if(it == timers.end()) + continue; + + auto timer = it->second; + timers.erase(it); + delete timer; + } oldTimers.clear();