From 3818fea7671055034d44e276187572a695269f0d Mon Sep 17 00:00:00 2001 From: BotoX Date: Mon, 5 Dec 2016 21:14:59 +0100 Subject: [PATCH] Fix some memleaks :^) --- AdvancedTargeting/scripting/AdvancedTargeting.sp | 3 +++ ForceInputs/scripting/ForceInputs.sp | 4 ++++ ReservedSlot/scripting/ReservedSlot.sp | 3 ++- mapchooser_extended/scripting/nominations_extended.sp | 8 ++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/AdvancedTargeting/scripting/AdvancedTargeting.sp b/AdvancedTargeting/scripting/AdvancedTargeting.sp index 0600bf69..130bf0de 100644 --- a/AdvancedTargeting/scripting/AdvancedTargeting.sp +++ b/AdvancedTargeting/scripting/AdvancedTargeting.sp @@ -356,6 +356,9 @@ public void APIWebResponse(const char[] sData, int client) return; } + if(g_FriendsArray[client] != INVALID_HANDLE) + CloseHandle(g_FriendsArray[client]); + g_FriendsArray[client] = CreateArray(); char sCommunityID[32]; diff --git a/ForceInputs/scripting/ForceInputs.sp b/ForceInputs/scripting/ForceInputs.sp index 412c8d83..03f066f1 100644 --- a/ForceInputs/scripting/ForceInputs.sp +++ b/ForceInputs/scripting/ForceInputs.sp @@ -122,7 +122,10 @@ public Action Command_ForceInput(int client, int args) int entity = TR_GetEntityIndex(hTrace); if(entity <= 1 || !IsValidEntity(entity)) + { + CloseHandle(hTrace); return Plugin_Handled; + } if(sArguments[2][0]) SetVariantString(sArguments[2]); @@ -130,6 +133,7 @@ public Action Command_ForceInput(int client, int args) AcceptEntityInput(entity, sArguments[1], client, client); ReplyToCommand(client, "[SM] Input successful."); } + CloseHandle(hTrace); } else { diff --git a/ReservedSlot/scripting/ReservedSlot.sp b/ReservedSlot/scripting/ReservedSlot.sp index 514813c7..8d4788af 100644 --- a/ReservedSlot/scripting/ReservedSlot.sp +++ b/ReservedSlot/scripting/ReservedSlot.sp @@ -108,14 +108,15 @@ public EConnect OnClientPreConnectEx(const char[] sName, char sPassword[255], co public void AsyncHasSteamIDReservedSlotCallback(const char[] sSteam32ID, int Result, any Data) { + DataPack pack = view_as(Data); // Slot free'd up while waiting or doesn't have a reserved slot? if(GetClientCount(false) < MaxClients || Result <= 0) { + delete pack; ClientPreConnectEx(sSteam32ID, k_OnClientPreConnectEx_Accept, ""); return; } - DataPack pack = view_as(Data); pack.Reset(); AdminId admin = view_as(pack.ReadCell()); diff --git a/mapchooser_extended/scripting/nominations_extended.sp b/mapchooser_extended/scripting/nominations_extended.sp index f087541a..a76d42eb 100644 --- a/mapchooser_extended/scripting/nominations_extended.sp +++ b/mapchooser_extended/scripting/nominations_extended.sp @@ -486,6 +486,14 @@ public Action Command_NominateList(int client, int args) public int Handler_NominateListMenu(Handle menu, MenuAction action, int param1, int param2) { + switch(action) + { + case MenuAction_End: + { + delete menu; + } + } + return 0; }