Fixed various memory leaks.

This commit is contained in:
Greyscale 2009-07-23 17:05:04 -07:00
parent 37fe9fae8b
commit d5e4e89ba5
5 changed files with 24 additions and 0 deletions

View File

@ -197,6 +197,8 @@ InfectOnClientDisconnect(client)
// If there are no eligible client's then stop. // If there are no eligible client's then stop.
if (!eligibleclients) if (!eligibleclients)
{ {
// Destroy handle.
CloseHandle(arrayEligibleClients);
return; return;
} }
@ -416,6 +418,8 @@ public Action:InfectMotherZombie(Handle:timer)
// If there are no eligible client's then stop. // If there are no eligible client's then stop.
if (!eligibleclients) if (!eligibleclients)
{ {
// Destroy handle.
CloseHandle(arrayEligibleClients);
return; return;
} }

View File

@ -302,6 +302,10 @@ stock ModelsGetRandomModelIndex(String:modelpath[], maxlen, bool:all = true, boo
if (size == 0) if (size == 0)
{ {
strcopy(modelpath, maxlen, ""); strcopy(modelpath, maxlen, "");
// Destroy the handle.
CloseHandle(modelsarray);
return; return;
} }

View File

@ -409,6 +409,11 @@ ClassLoad(bool:keepMultipliers = false)
if (!exists) if (!exists)
{ {
LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Missing playerclasses config file \"%s\"", pathclasses); LogEvent(false, LogType_Fatal, LOG_CORE_EVENTS, LogModule_Playerclasses, "Config Validation", "Missing playerclasses config file \"%s\"", pathclasses);
// Remove key/value cache.
CloseHandle(kvClassData);
kvClassData = INVALID_HANDLE;
return; return;
} }

View File

@ -340,6 +340,9 @@ RoundEndBalanceTeams()
// If there are no eligible client's then stop. // If there are no eligible client's then stop.
if (!eligibleclients) if (!eligibleclients)
{ {
// Destroy handle.
CloseHandle(arrayEligibleClients);
return; return;
} }

View File

@ -78,6 +78,10 @@ SayHooksGetPublicChatTrigger(String:trigger[], maxlen)
if (!success) if (!success)
{ {
strcopy(trigger, maxlen, SAYHOOKS_CHAT_PUBLIC_DEFAULT); strcopy(trigger, maxlen, SAYHOOKS_CHAT_PUBLIC_DEFAULT);
// Close the handle.
CloseHandle(kvCore);
return; return;
} }
@ -117,6 +121,10 @@ SayHooksGetSilentChatTrigger(String:trigger[], maxlen)
if (!success) if (!success)
{ {
strcopy(trigger, maxlen, SAYHOOKS_CHAT_SILENT_DEFAULT); strcopy(trigger, maxlen, SAYHOOKS_CHAT_SILENT_DEFAULT);
// Close the handle.
CloseHandle(kvCore);
return; return;
} }