mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Fix a crash bug in WebModules
WebModules use CHTTPSock for the HTTP server. That class requires a CModule instance for working since it's based on CSocket. This was solved by creating a fake module instance which is destroyed when the socket is destroyed. The problem here was that CSocket's destructor tried to access that module instance which was already destroyed resulting in a use-after-free. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1824 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -118,10 +118,10 @@ CWebSock::~CWebSock() {
|
||||
}
|
||||
|
||||
// If the module IsFake() then it was created as a dummy and needs to be deleted
|
||||
CModule* pMod = GetModule();
|
||||
if (pMod && pMod->IsFake()) {
|
||||
pMod->UnlinkSocket(this);
|
||||
delete pMod;
|
||||
if (m_pModule && m_pModule->IsFake()) {
|
||||
m_pModule->UnlinkSocket(this);
|
||||
delete m_pModule;
|
||||
m_pModule = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user