Fixed mem leak in clientprefs

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402310
This commit is contained in:
Matt Woodrow 2008-06-30 23:07:54 +00:00
parent 8a5d833c89
commit cdf54a3db1
3 changed files with 10 additions and 2 deletions

View File

@ -222,6 +222,8 @@ void CookieManager::OnClientDisconnecting(int client)
if (!current->changed)
{
current->parent->data[client] = NULL;
delete current;
_iter = clientData[client].erase(_iter);
continue;
}
@ -314,7 +316,6 @@ void CookieManager::ClientConnectCallback(int client, IQuery *data)
} while (results->MoreRows());
statsLoaded[client] = true;
cookieDataLoadedForward->PushCell(client);

View File

@ -194,7 +194,6 @@ bool ClientPrefs::SDK_OnLoad(char *error, size_t maxlength, bool late)
phrases->AddPhraseFile("clientprefs.phrases");
phrases->AddPhraseFile("common.phrases");
return true;
}
@ -206,6 +205,7 @@ void ClientPrefs::SDK_OnAllLoaded()
void ClientPrefs::SDK_OnUnload()
{
handlesys->RemoveType(g_CookieType, myself->GetIdentity());
handlesys->RemoveType(g_CookieIterator, myself->GetIdentity());
g_CookieManager.Unload();
@ -214,6 +214,11 @@ void ClientPrefs::SDK_OnUnload()
forwards->ReleaseForward(g_CookieManager.cookieDataLoadedForward);
g_CookieManager.clientMenu->Destroy();
phrases->Destroy();
plsys->RemovePluginsListener(&g_CookieManager);
playerhelpers->RemoveClientListener(&g_CookieManager);
}
size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...)

View File

@ -98,6 +98,7 @@ TQueryOp::TQueryOp(IDatabase *db, const char *query, enum querytype type, int cl
m_Query = query;
m_type = type;
m_client = client;
m_pQuery = NULL;
m_pDatabase->IncReferenceCount();
}
@ -108,6 +109,7 @@ TQueryOp::TQueryOp(IDatabase *db, const char *query, enum querytype type, Cookie
m_Query = query;
m_type = type;
pCookie = cookie;
m_pQuery = NULL;
m_pDatabase->IncReferenceCount();
}