From 78af088fd7a0f87d862446d042da412560a464d9 Mon Sep 17 00:00:00 2001 From: psychon Date: Sat, 17 Oct 2009 15:44:51 +0000 Subject: [PATCH] Fix a memory leak/crash in CModule CModule::RemTimer(CTimer* pTimer) only removed the timer from CModule's own list of timers but didn't actually destroy the timer. This meant that the timer could continue to run after it was supposed to be deleted. Because CModule's destructor used this function this means that all timers active when a module is unloaded where leaked. When these timers where then later destroyed this caused a crash because their vtable points inside the module which was already unloaded (not good!). Thanks to KiNgMaR for finding and reporting this crash bug. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1650 726aef4b-f618-498e-8847-2d620e286838 --- Modules.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules.cpp b/Modules.cpp index 967a93df..37c90b97 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -328,6 +328,7 @@ bool CModule::AddTimer(FPTimer_t pFBCallback, const CString& sLabel, u_int uInte bool CModule::RemTimer(CTimer* pTimer) { if (m_sTimers.erase(pTimer) == 0) return false; + m_pManager->DelCronByAddr(pTimer); return true; }