Fix a mem leak in ZNC core

CUser::DelChan() didn't actually delete anything, so if you joined much... well


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@856 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2007-10-28 18:11:44 +00:00
parent ee350ab744
commit 434231f530
2 changed files with 12 additions and 1 deletions
+11 -1
View File
@@ -511,9 +511,13 @@ void CIRCSock::ReadLine(const CString& sData) {
}
CChan* pChan = m_pUser->FindChan(sChan);
bool bDetached = false;
if (pChan) {
pChan->RemNick(Nick.GetNick());
MODULECALL(OnPart(Nick.GetNickMask(), *pChan), m_pUser, NULL, );
if (pChan->IsDetached())
bDetached = true;
}
// Todo: use nick compare function
@@ -521,7 +525,13 @@ void CIRCSock::ReadLine(const CString& sData) {
m_pUser->DelChan(sChan);
}
if ((pChan) && (pChan->IsDetached())) {
/*
* We use this boolean because
* m_pUser->DelChan() will delete this channel
* and thus we would dereference an
* already-freed pointer!
*/
if (bDetached) {
return;
}
} else if (sCmd.CaseCmp("MODE") == 0) {