Skip to content
Permalink
Browse files

Fix 2 memory leaks

  • Loading branch information...
Bara committed Jul 20, 2019
1 parent a774c26 commit 868d4d9f7a86ef65ec719ddca72828ec6101513c
@@ -2828,6 +2828,8 @@ public void Frame_RechangeName(DataPack pack)

char sName[MAX_NAME_LENGTH];
pack.ReadString(sName, sizeof(sName));

delete pack;

int client = GetClientOfUserId(userid);

@@ -3458,9 +3460,9 @@ public int TTT_OnButtonPress(int client, int button)

if (!g_cSilentIdEnabled.BoolValue || !(bInWalk && TTT_IsValidRole(client, g_cSilentIdRoles.IntValue)))
{
char sBuffer[32];
Format(sBuffer, sizeof(sBuffer), "Found %s", sVictimRole);
char sBuffer[32];
Format(sBuffer, sizeof(sBuffer), "Found %s", sVictimRole);
LoopValidClients(j)
{
CPrintToChat(j, "%s %T", g_sTag, sBuffer, j, client, iRagdollC[VictimName]);
@@ -3489,7 +3491,7 @@ public int TTT_OnButtonPress(int client, int button)

if (bSetColor)
{
if (iRagdollC[VictimTeam] == TTT_TEAM_INNOCENT)
if (iRagdollC[VictimTeam] == TTT_TEAM_INNOCENT)
{
SetEntityRenderColor(iEntity, 0, 255, 0, 255);
}
@@ -252,6 +252,7 @@ public void Frame_DropEntity(DataPack pack)
pack.Reset();
int client = GetClientOfUserId(pack.ReadCell());
int iEntity = EntRefToEntIndex(pack.ReadCell());
delete pack;

if (TTT_IsClientValid(client) && IsValidEntity(iEntity))
{
@@ -281,46 +281,42 @@ public Action Timer_Revive(Handle timer, DataPack pack)

int client = GetClientOfUserId(pack.ReadCell());
int entity = EntRefToEntIndex(pack.ReadCell());

delete pack;

if (!TTT_IsClientValid(client) || !g_bHasRevive[client])
{
g_hTimer[client] = null;
delete pack;
return Plugin_Stop;
}

if (g_hTimer[client] == null)
{
g_hTimer[client] = null;
delete pack;
return Plugin_Stop;
}

if (g_iEndTime[client] == -1 || g_iStartTime[client] == -1 || g_iCountdown[client] == -1)
{
g_hTimer[client] = null;
delete pack;
return Plugin_Stop;
}

if (!IsValidEntity(entity))
{
g_hTimer[client] = null;
delete pack;
return Plugin_Stop;
}

if (!g_bInUse[client])
{
g_hTimer[client] = null;
delete pack;
return Plugin_Stop;
}

if (g_iRagdoll[client] == TTT_GetGrabEntity(client))
{
g_hTimer[client] = null;
delete pack;
return Plugin_Stop;
}

@@ -329,21 +325,18 @@ public Action Timer_Revive(Handle timer, DataPack pack)
if (!TTT_IsClientValid(target))
{
g_hTimer[client] = null;
delete pack;
return Plugin_Stop;
}

if (TTT_GetClientRole(target) != TTT_TEAM_TRAITOR && TTT_GetClientRole(target) != TTT_TEAM_DETECTIVE)
{
g_hTimer[client] = null;
delete pack;
return Plugin_Stop;
}

if (TTT_GetClientRole(client) != TTT_GetClientRole(target))
{
g_hTimer[client] = null;
delete pack;
return Plugin_Stop;
}

@@ -364,7 +357,6 @@ public Action Timer_Revive(Handle timer, DataPack pack)
}

g_hTimer[client] = null;
delete pack;
return Plugin_Stop;
}

0 comments on commit 868d4d9

Please sign in to comment.
You can’t perform that action at this time.