CloseHandle -> delete

This commit is contained in:
neon 2019-07-07 22:44:43 +02:00
parent 4dd4ff521b
commit eeba405984
18 changed files with 258 additions and 292 deletions

View File

@ -90,7 +90,7 @@ public void OnPluginStart()
HookConVarChange((cvar = CreateConVar("sm_afk_immunity", "1", "AFK admins immunity: 0 = DISABLED, 1 = COMPLETE, 2 = KICK, 3 = MOVE")), Cvar_Immunity); HookConVarChange((cvar = CreateConVar("sm_afk_immunity", "1", "AFK admins immunity: 0 = DISABLED, 1 = COMPLETE, 2 = KICK, 3 = MOVE")), Cvar_Immunity);
g_iImmunity = GetConVarInt(cvar); g_iImmunity = GetConVarInt(cvar);
CloseHandle(cvar); delete cvar;
AddCommandListener(Command_Say, "say"); AddCommandListener(Command_Say, "say");
AddCommandListener(Command_Say, "say_team"); AddCommandListener(Command_Say, "say_team");

View File

@ -36,14 +36,14 @@ public void OnPluginStart()
int iMaxClipOffset; int iMaxClipOffset;
if ((iMaxClipOffset = GameConfGetOffset(hGameConf, "GetMaxClip")) == -1) if ((iMaxClipOffset = GameConfGetOffset(hGameConf, "GetMaxClip")) == -1)
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("GameConfGetOffset(hGameConf, \"GetMaxClip\") failed!"); SetFailState("GameConfGetOffset(hGameConf, \"GetMaxClip\") failed!");
return; return;
} }
if ((g_hGetMaxClip = DHookCreate(iMaxClipOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxClip)) == INVALID_HANDLE) if ((g_hGetMaxClip = DHookCreate(iMaxClipOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxClip)) == INVALID_HANDLE)
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("DHookCreate(iMaxClipOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxClip) failed!"); SetFailState("DHookCreate(iMaxClipOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxClip) failed!");
return; return;
} }
@ -54,14 +54,14 @@ public void OnPluginStart()
int iMaxReserveOffset; int iMaxReserveOffset;
if ((iMaxReserveOffset = GameConfGetOffset(hGameConf, "GetMaxReserve")) == -1) if ((iMaxReserveOffset = GameConfGetOffset(hGameConf, "GetMaxReserve")) == -1)
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("GameConfGetOffset(hGameConf, \"GetMaxReserve\") failed!"); SetFailState("GameConfGetOffset(hGameConf, \"GetMaxReserve\") failed!");
return; return;
} }
if ((g_hGetMaxReserve = DHookCreate(iMaxReserveOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxReserve)) == INVALID_HANDLE) if ((g_hGetMaxReserve = DHookCreate(iMaxReserveOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxReserve)) == INVALID_HANDLE)
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("DHookCreate(iMaxReserveOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxReserve) failed!"); SetFailState("DHookCreate(iMaxReserveOffset, HookType_Entity, ReturnType_Int, ThisPointer_CBaseEntity, OnGetMaxReserve) failed!");
return; return;
} }
@ -74,7 +74,7 @@ public void OnPluginStart()
OnEntityCreated(entity, "weapon_*"); OnEntityCreated(entity, "weapon_*");
} }
CloseHandle(hGameConf); delete hGameConf;
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------

View File

@ -91,38 +91,14 @@ void CheckDirectories()
public void RestartTimers() public void RestartTimers()
{ {
delete g_hDrawFullZone;
delete g_hDrawZone;
delete g_hHudLoop;
delete g_hSideHudLoop;
if (g_hDrawFullZone != INVALID_HANDLE)
{
CloseHandle(g_hDrawFullZone);
g_hDrawFullZone = INVALID_HANDLE;
}
if (g_hDrawZone != INVALID_HANDLE)
{
CloseHandle(g_hDrawZone);
g_hDrawZone = INVALID_HANDLE;
}
if (g_hHudLoop != INVALID_HANDLE)
{
CloseHandle(g_hHudLoop);
g_hHudLoop = INVALID_HANDLE;
}
if (g_hSideHudLoop != INVALID_HANDLE)
{
CloseHandle(g_hSideHudLoop);
g_hSideHudLoop = INVALID_HANDLE;
}
if (g_hDrawFullZone == INVALID_HANDLE)
g_hDrawFullZone = CreateTimer(0.2, DrawFullZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); g_hDrawFullZone = CreateTimer(0.2, DrawFullZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
if (g_hDrawZone == INVALID_HANDLE)
g_hDrawZone = CreateTimer(1.0, DrawZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); g_hDrawZone = CreateTimer(1.0, DrawZoneTimer, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
if (g_hHudLoop == INVALID_HANDLE)
g_hHudLoop = CreateTimer(0.2, HudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); g_hHudLoop = CreateTimer(0.2, HudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
if (g_hSideHudLoop == INVALID_HANDLE)
g_hSideHudLoop = CreateTimer(1.0, SideHudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); g_hSideHudLoop = CreateTimer(1.0, SideHudLoop, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
} }

View File

@ -196,8 +196,7 @@ public Action Command_JoinMsg(int client, int args)
char sAuth[32]; char sAuth[32];
GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth)); GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
if (g_hCustomMessageFile != null) delete g_hCustomMessageFile;
CloseHandle(g_hCustomMessageFile);
g_hCustomMessageFile = CreateKeyValues("custom_messages"); g_hCustomMessageFile = CreateKeyValues("custom_messages");
@ -270,8 +269,7 @@ public Action Command_ResetJoinMsg(int client, int args)
char sAuth[32]; char sAuth[32];
GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth)); GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
if (g_hCustomMessageFile != null) delete g_hCustomMessageFile;
CloseHandle(g_hCustomMessageFile);
g_hCustomMessageFile = CreateKeyValues("custom_messages"); g_hCustomMessageFile = CreateKeyValues("custom_messages");
@ -323,7 +321,7 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
{ {
ReadFileLine(hFile, sRawMsg, sizeof(sRawMsg)); ReadFileLine(hFile, sRawMsg, sizeof(sRawMsg));
TrimString(sRawMsg); TrimString(sRawMsg);
CloseHandle(hFile); delete hFile;
} }
else else
{ {
@ -411,8 +409,7 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
return; return;
} }
if (g_hCustomMessageFile2 != null) delete g_hCustomMessageFile2;
CloseHandle(g_hCustomMessageFile2);
g_hCustomMessageFile2 = CreateKeyValues("custom_messages"); g_hCustomMessageFile2 = CreateKeyValues("custom_messages");

View File

@ -54,7 +54,7 @@ public void OnPluginStart()
HookConVarChange((cvar = CreateConVar("sm_happyhour_message_interval", "60.0", "interval for repetetive message of happy hour in chat")), g_cvMessageTimer); HookConVarChange((cvar = CreateConVar("sm_happyhour_message_interval", "60.0", "interval for repetetive message of happy hour in chat")), g_cvMessageTimer);
g_fMessageTimer = cvar.FloatValue; g_fMessageTimer = cvar.FloatValue;
CloseHandle(cvar); delete cvar;
RegConsoleCmd("sm_hh", Command_DisplayHappyHour, "Shows if happy hour is currently enabled or not"); RegConsoleCmd("sm_hh", Command_DisplayHappyHour, "Shows if happy hour is currently enabled or not");
@ -87,8 +87,7 @@ public void g_cvMessageTimer(ConVar convar, const char[] oldValue, const char[]
{ {
g_fMessageTimer = convar.FloatValue; g_fMessageTimer = convar.FloatValue;
if (g_h_MessageTimer != INVALID_HANDLE && CloseHandle(g_h_MessageTimer)) delete g_h_MessageTimer;
g_h_MessageTimer = INVALID_HANDLE;
g_h_MessageTimer = CreateTimer(g_fMessageTimer, MessageHappyHour, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); g_h_MessageTimer = CreateTimer(g_fMessageTimer, MessageHappyHour, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
} }

View File

@ -61,19 +61,19 @@ public void OnPluginStart()
} }
if(GameConfGetOffset(hGameConf, "GetSlot") == -1) if(GameConfGetOffset(hGameConf, "GetSlot") == -1)
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("Couldn't get GetSlot offset from game config!"); SetFailState("Couldn't get GetSlot offset from game config!");
return; return;
} }
if(GameConfGetOffset(hGameConf, "BumpWeapon") == -1) if(GameConfGetOffset(hGameConf, "BumpWeapon") == -1)
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("Couldn't get BumpWeapon offset from game config!"); SetFailState("Couldn't get BumpWeapon offset from game config!");
return; return;
} }
if(GameConfGetOffset(hGameConf, "OnPickedUp") == -1) if(GameConfGetOffset(hGameConf, "OnPickedUp") == -1)
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("Couldn't get OnPickedUp offset from game config!"); SetFailState("Couldn't get OnPickedUp offset from game config!");
return; return;
} }
@ -82,7 +82,7 @@ public void OnPluginStart()
StartPrepSDKCall(SDKCall_Entity); StartPrepSDKCall(SDKCall_Entity);
if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "GetSlot")) if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "GetSlot"))
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"GetSlot\" failed!"); SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"GetSlot\" failed!");
return; return;
} }
@ -93,7 +93,7 @@ public void OnPluginStart()
StartPrepSDKCall(SDKCall_Player); StartPrepSDKCall(SDKCall_Player);
if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "BumpWeapon")) if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "BumpWeapon"))
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"BumpWeapon\" failed!"); SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"BumpWeapon\" failed!");
return; return;
} }
@ -105,7 +105,7 @@ public void OnPluginStart()
StartPrepSDKCall(SDKCall_Entity); StartPrepSDKCall(SDKCall_Entity);
if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "OnPickedUp")) if(!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "OnPickedUp"))
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"OnPickedUp\" failed!"); SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"OnPickedUp\" failed!");
return; return;
} }

View File

@ -307,7 +307,7 @@ public int Handler_MakoVoteMenu(Handle menu, MenuAction action, int param1, int
{ {
case MenuAction_End: case MenuAction_End:
{ {
CloseHandle(menu); delete menu;
if (param1 != -1) if (param1 != -1)
{ {

View File

@ -44,7 +44,7 @@ public void OnPluginStart()
g_fSelfExtendsRatio = cvar.FloatValue; g_fSelfExtendsRatio = cvar.FloatValue;
HookConVarChange((cvar = CreateConVar("sm_selfextend_delay", "60.0", "Time to pass until sm_selfextend can be used")), Cvar_SelfExtendsDelay); HookConVarChange((cvar = CreateConVar("sm_selfextend_delay", "60.0", "Time to pass until sm_selfextend can be used")), Cvar_SelfExtendsDelay);
g_fSelfExtendsDelay = cvar.FloatValue; g_fSelfExtendsDelay = cvar.FloatValue;
CloseHandle(cvar); delete cvar;
g_cvarTimeLimit = FindConVar("mp_timelimit"); g_cvarTimeLimit = FindConVar("mp_timelimit");

View File

@ -33,14 +33,14 @@ public void OnPluginStart()
int iOffset; int iOffset;
if ((iOffset = GameConfGetOffset(hGameConf, "SelectSpawnPoint")) == -1) if ((iOffset = GameConfGetOffset(hGameConf, "SelectSpawnPoint")) == -1)
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("GameConfGetOffset(hGameConf, \"SelectSpawnPoint\") failed!"); SetFailState("GameConfGetOffset(hGameConf, \"SelectSpawnPoint\") failed!");
return; return;
} }
if ((hSelectSpawnPoint = DHookCreate(iOffset, HookType_Entity, ReturnType_CBaseEntity, ThisPointer_CBaseEntity, OnPlayerSelectSpawnPoint)) == INVALID_HANDLE) if ((hSelectSpawnPoint = DHookCreate(iOffset, HookType_Entity, ReturnType_CBaseEntity, ThisPointer_CBaseEntity, OnPlayerSelectSpawnPoint)) == INVALID_HANDLE)
{ {
CloseHandle(hGameConf); delete hGameConf;
SetFailState("DHookCreate(iOffset, HookType_Entity, ReturnType_CBaseEntity, ThisPointer_CBaseEntity, OnPlayerSelectSpawnPoint) failed!"); SetFailState("DHookCreate(iOffset, HookType_Entity, ReturnType_CBaseEntity, ThisPointer_CBaseEntity, OnPlayerSelectSpawnPoint) failed!");
return; return;
} }
@ -54,7 +54,7 @@ public void OnPluginStart()
} }
} }
CloseHandle(hGameConf); delete hGameConf;
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------

View File

@ -740,7 +740,7 @@ public void OnReloadEffect(DataPack pack)
} }
} }
CloseHandle(pack); delete pack;
Handle ReloadEffect = StartMessage("ReloadEffect", players, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS); Handle ReloadEffect = StartMessage("ReloadEffect", players, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS);
if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf) if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf)

View File

@ -177,7 +177,7 @@ public ClearExistingData()
continue; continue;
} }
CloseHandle(hHandle); delete hHandle;
} }
ClearArray(g_hIndexArray); ClearArray(g_hIndexArray);
@ -213,14 +213,14 @@ public ProcessFile(const String:sPathToFile[])
if (iLine > 0) if (iLine > 0)
{ {
LogError("Could not parse file (Line: %d, File \"%s\"): %s.", iLine, sPathToFile, sError); LogError("Could not parse file (Line: %d, File \"%s\"): %s.", iLine, sPathToFile, sError);
CloseHandle(hSMC); /* Sneaky Handles. */ delete hSMC; /* Sneaky Handles. */
return; return;
} }
LogError("Parser encountered error (File: \"%s\"): %s.", sPathToFile, sError); LogError("Parser encountered error (File: \"%s\"): %s.", sPathToFile, sError);
} }
CloseHandle(hSMC); delete hSMC;
} }
public SMCResult:SMCNewSection(Handle:smc, const String:name[], bool:opt_quotes) public SMCResult:SMCNewSection(Handle:smc, const String:name[], bool:opt_quotes)
@ -284,7 +284,7 @@ public SMCResult:SMCReadKeyValues(Handle:smc, const String:key[], const String:v
RemoveFromTrie(g_hFastLookupTrie, g_sCurrentSection); RemoveFromTrie(g_hFastLookupTrie, g_sCurrentSection);
} }
CloseHandle(g_hCurrentTrie); /* We're about to invalidate below */ delete g_hCurrentTrie; /* We're about to invalidate below */
if (GetTrieValue(g_hFastLookupTrie, value, g_hCurrentTrie)) if (GetTrieValue(g_hFastLookupTrie, value, g_hCurrentTrie))
{ {
@ -421,7 +421,7 @@ public DisplayMOTDWithOptions(iClient, const String:sTitle[], const String:sUrl[
} }
ShowVGUIPanel(iClient, "info", hKv, bNotSilent); ShowVGUIPanel(iClient, "info", hKv, bNotSilent);
CloseHandle(hKv); delete hKv;
} }
static stock bool:IsValidClient(iClient) static stock bool:IsValidClient(iClient)

View File

@ -270,7 +270,7 @@ stock CAddVariable(String:sName[], String:sValue[], bool:bOnlySaveToConfig = fal
new Handle:hKV = CreateKeyValues("colorvariables"); new Handle:hKV = CreateKeyValues("colorvariables");
if (!FileToKeyValues(hKV, g_sConfig)) { if (!FileToKeyValues(hKV, g_sConfig)) {
CloseHandle(hKV); delete hKV;
LogError("Cannot open file (for adding color variable) '%s' !", g_sConfig); LogError("Cannot open file (for adding color variable) '%s' !", g_sConfig);
return; return;
} }
@ -284,13 +284,13 @@ stock CAddVariable(String:sName[], String:sValue[], bool:bOnlySaveToConfig = fal
PushArrayString(hRedirect, sName); PushArrayString(hRedirect, sName);
SetTrieString(g_hColors, sName, sValue); SetTrieString(g_hColors, sName, sValue);
SolveRedirects(g_hColors, hRedirect); SolveRedirects(g_hColors, hRedirect);
CloseHandle(hRedirect); delete hRedirect;
} }
} }
KvRewind(hKV); KvRewind(hKV);
KeyValuesToFile(hKV, g_sConfig); KeyValuesToFile(hKV, g_sConfig);
CloseHandle(hKV); delete hKV;
} }
} }
@ -310,7 +310,7 @@ stock CLoadPluginConfig(const String:sPluginName[], bool:bAllowPrefix = true)
new Handle:hRedirect = CreateArray(64); new Handle:hRedirect = CreateArray(64);
LoadConfigFile(g_hColors, sConfig, hRedirect, bAllowPrefix); LoadConfigFile(g_hColors, sConfig, hRedirect, bAllowPrefix);
SolveRedirects(g_hColors, hRedirect); SolveRedirects(g_hColors, hRedirect);
CloseHandle(hRedirect); delete hRedirect;
} }
} }
@ -346,8 +346,8 @@ stock CLoadPluginVariables(const String:sPluginName[], const String:sVariables[]
} }
SolveRedirects(g_hColors, hRedirect); SolveRedirects(g_hColors, hRedirect);
CloseHandle(hRedirect); delete hRedirect;
CloseHandle(hVariables); delete hVariables;
} }
} }
@ -571,8 +571,7 @@ stock bool:Init()
} }
WriteFileLine(hConfig, "}"); WriteFileLine(hConfig, "}");
CloseHandle(hConfig); delete hConfig;
hConfig = INVALID_HANDLE;
} else { } else {
hConfig = OpenFile(g_sConfigGlobal, "r"); hConfig = OpenFile(g_sConfigGlobal, "r");
if (hConfig == INVALID_HANDLE) { if (hConfig == INVALID_HANDLE) {
@ -582,7 +581,7 @@ stock bool:Init()
new String:sVersionLine[64]; new String:sVersionLine[64];
ReadFileLine(hConfig, sVersionLine, sizeof(sVersionLine)); ReadFileLine(hConfig, sVersionLine, sizeof(sVersionLine));
CloseHandle(hConfig); delete hConfig;
TrimString(sVersionLine); TrimString(sVersionLine);
strcopy(sVersionLine, sizeof(sVersionLine), sVersionLine[FindCharInString(sVersionLine, ':') + 2]); strcopy(sVersionLine, sizeof(sVersionLine), sVersionLine[FindCharInString(sVersionLine, ':') + 2]);
@ -591,7 +590,7 @@ stock bool:Init()
new Handle:hKV = CreateKeyValues("colorvariables"); new Handle:hKV = CreateKeyValues("colorvariables");
if (!FileToKeyValues(hKV, g_sConfigGlobal) || !KvGotoFirstSubKey(hKV, false)) { if (!FileToKeyValues(hKV, g_sConfigGlobal) || !KvGotoFirstSubKey(hKV, false)) {
CloseHandle(hKV); delete hKV;
LogError("Cannot read variables from file '%s' !", g_sConfigGlobal); LogError("Cannot read variables from file '%s' !", g_sConfigGlobal);
return false; return false;
} }
@ -629,8 +628,8 @@ stock bool:Init()
WriteFileLine(hConfig, "}"); WriteFileLine(hConfig, "}");
CloseHandle(hConfig); delete hConfig;
CloseHandle(hKV); delete hKV;
} }
} }
@ -643,8 +642,7 @@ stock bool:Init()
} }
WriteFileLine(hConfig, "\"colorvariables\"\n{\n}"); WriteFileLine(hConfig, "\"colorvariables\"\n{\n}");
CloseHandle(hConfig); delete hConfig;
hConfig = INVALID_HANDLE;
} }
for (new iClient = 1; iClient <= MaxClients; iClient++) { for (new iClient = 1; iClient <= MaxClients; iClient++) {
@ -683,13 +681,13 @@ stock static LoadConfigFile(Handle:hTrie, String:sPath[], Handle:hRedirect, bool
new Handle:hKV = CreateKeyValues("colorvariables"); new Handle:hKV = CreateKeyValues("colorvariables");
if (!FileToKeyValues(hKV, sPath)) { if (!FileToKeyValues(hKV, sPath)) {
CloseHandle(hKV); delete hKV;
LogError("Cannot load color variables from file '%s' !", sPath); LogError("Cannot load color variables from file '%s' !", sPath);
return; return;
} }
if (!KvGotoFirstSubKey(hKV, false)) { if (!KvGotoFirstSubKey(hKV, false)) {
CloseHandle(hKV); delete hKV;
return; return;
} }
@ -723,7 +721,7 @@ stock static LoadConfigFile(Handle:hTrie, String:sPath[], Handle:hRedirect, bool
SetTrieString(hTrie, sCode, sColor); SetTrieString(hTrie, sCode, sColor);
} while (KvGotoNextKey(hKV, false)); } while (KvGotoNextKey(hKV, false));
CloseHandle(hKV); delete hKV;
} }
stock static SolveRedirects(Handle:hTrie, Handle:hRedirect) stock static SolveRedirects(Handle:hTrie, Handle:hRedirect)

View File

@ -252,7 +252,7 @@ stock void MC_ReplaceColorCodes(char[] buffer, int author = 0, bool removeTags =
Handle regex = CompileRegex("{[a-zA-Z0-9]+}"); Handle regex = CompileRegex("{[a-zA-Z0-9]+}");
for(int i = 0; i < 1000; i++) { // The RegEx extension is quite flaky, so we have to loop here :/. This loop is supposed to be infinite and broken by return, but conditions have been added to be safe. for(int i = 0; i < 1000; i++) { // The RegEx extension is quite flaky, so we have to loop here :/. This loop is supposed to be infinite and broken by return, but conditions have been added to be safe.
if(MatchRegex(regex, buffer[cursor]) < 1) { if(MatchRegex(regex, buffer[cursor]) < 1) {
CloseHandle(regex); delete regex;
strcopy(buffer, maxlen, output); strcopy(buffer, maxlen, output);
return; return;
} }

View File

@ -290,7 +290,7 @@ native bool json_object_update_missing(JSONObject hObj, JSONObject hOther);
* *
* // Do something with sKey and hValue * // Do something with sKey and hValue
* *
* CloseHandle(hValue); * delete hValue;
* *
* hIterator = json_object_iter_next(hObj, hIterator); * hIterator = json_object_iter_next(hObj, hIterator);
* } * }
@ -1575,7 +1575,7 @@ public JSONObject json_pack_object_(const char[] sFormat, int &iPos, Handle hPar
if(this_char != 115) { if(this_char != 115) {
LogError("Object keys must be strings at %d.", iPos); LogError("Object keys must be strings at %d.", iPos);
CloseHandle(hObj); delete hObj;
return view_as<JSONObject>(INVALID_HANDLE); return view_as<JSONObject>(INVALID_HANDLE);
} }

View File

@ -816,7 +816,7 @@ public int LeaderMenu_Handler(Handle menu, MenuAction action, int client, int po
} }
else if(action == MenuAction_End) else if(action == MenuAction_End)
{ {
CloseHandle(menu); delete menu;
} }
} }
@ -912,7 +912,7 @@ public int SpriteMenu_Handler(Handle menu, MenuAction action, int client, int po
} }
else if(action == MenuAction_End) else if(action == MenuAction_End)
{ {
CloseHandle(menu); delete menu;
} }
else if (action == MenuAction_Cancel && position == MenuCancel_ExitBack) else if (action == MenuAction_Cancel && position == MenuCancel_ExitBack)
{ {
@ -989,7 +989,7 @@ public int MarkerMenu_Handler(Handle menu, MenuAction action, int client, int po
} }
else if(action == MenuAction_End) else if(action == MenuAction_End)
{ {
CloseHandle(menu); delete menu;
} }
else if (action == MenuAction_Cancel && position == MenuCancel_ExitBack) else if (action == MenuAction_Cancel && position == MenuCancel_ExitBack)
{ {

View File

@ -1192,7 +1192,7 @@ void InitiateVote(MapChange when, Handle inputlist=INVALID_HANDLE)
AddMapItem(map); AddMapItem(map);
} }
CloseHandle(randomizeList); delete randomizeList;
randomizeList = INVALID_HANDLE; randomizeList = INVALID_HANDLE;
} }
@ -1233,7 +1233,7 @@ void InitiateVote(MapChange when, Handle inputlist=INVALID_HANDLE)
AddMenuItem(g_VoteMenu, VOTE_EXTEND, "Extend Map"); AddMenuItem(g_VoteMenu, VOTE_EXTEND, "Extend Map");
} }
} }
CloseHandle(inputlist); delete inputlist;
} }
int voteDuration = GetConVarInt(g_Cvar_VoteDuration); int voteDuration = GetConVarInt(g_Cvar_VoteDuration);
@ -1482,7 +1482,7 @@ public int Handler_MapVoteMenu(Handle menu, MenuAction action, int param1, int p
if(g_NativeVotes) if(g_NativeVotes)
NativeVotes_Close(menu); NativeVotes_Close(menu);
else else
CloseHandle(menu); delete menu;
} }
case MenuAction_Display: case MenuAction_Display:
@ -1748,7 +1748,7 @@ void CreateNextVote()
} }
delete groupmap; delete groupmap;
CloseHandle(tempMaps); delete tempMaps;
} }
bool CanVoteStart() bool CanVoteStart()

View File

@ -179,7 +179,7 @@ public OnListBans(Handle:owner, Handle:hndl, const String:error[], any:pack)
new client = GetClientOfUserId(clientuid); new client = GetClientOfUserId(clientuid);
decl String:targetName[MAX_NAME_LENGTH]; decl String:targetName[MAX_NAME_LENGTH];
ReadPackString(pack, targetName, sizeof(targetName)); ReadPackString(pack, targetName, sizeof(targetName));
CloseHandle(pack); delete pack;
if (clientuid > 0 && client == 0) if (clientuid > 0 && client == 0)
return; return;

View File

@ -781,11 +781,7 @@ public Action Sparks(Handle timer)
stock ClearTimer(&Handle:timer) stock ClearTimer(&Handle:timer)
{ {
if (timer != INVALID_HANDLE) delete timer;
{
CloseHandle(timer);
timer = INVALID_HANDLE;
}
} }
public Action SpawnSeagullRelay() public Action SpawnSeagullRelay()