Skip to content

Commit 41c1ab8

Browse files
authored
Merge pull request #581 from geominorai/patch/580
Fix DataPack early handle free Co-Author: geominorai <geominorai@users.noreply.github.com>
2 parents 7f81044 + a21d045 commit 41c1ab8

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

game/addons/sourcemod/scripting/sbpp_main.sp

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,14 +1183,14 @@ public void VerifyInsert(Database db, DBResultSet results, const char[] error, D
11831183
}
11841184

11851185
// Kick player
1186-
if (GetClientUserId(client) == UserId)
1187-
{
1188-
char length[32];
1189-
if(time == 0)
1190-
FormatEx(length, sizeof(length), "permament");
1191-
else
1192-
FormatEx(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes");
1193-
KickClient(client, "%t\n\n%t", "Banned Check Site", WebsiteAddress, "Kick Reason", admin, Reason, length);
1186+
if (GetClientUserId(client) == UserId)
1187+
{
1188+
char length[32];
1189+
if(time == 0)
1190+
FormatEx(length, sizeof(length), "permament");
1191+
else
1192+
FormatEx(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes");
1193+
KickClient(client, "%t\n\n%t", "Banned Check Site", WebsiteAddress, "Kick Reason", admin, Reason, length);
11941194
}
11951195
}
11961196

@@ -1295,7 +1295,6 @@ public void SelectUnbanCallback(Database db, DBResultSet results, const char[] e
12951295
dataPack.ReadString(reason, sizeof(reason));
12961296
dataPack.ReadString(arg, sizeof(arg));
12971297
dataPack.ReadString(adminAuth, sizeof(adminAuth));
1298-
delete dataPack;
12991298

13001299
db.Escape(reason, unbanReason, sizeof(unbanReason));
13011300

@@ -1307,6 +1306,7 @@ public void SelectUnbanCallback(Database db, DBResultSet results, const char[] e
13071306
{
13081307
PrintToChat(admin, "%ssm_unban failed", Prefix);
13091308
}
1309+
delete dataPack;
13101310
return;
13111311
}
13121312

@@ -1319,6 +1319,7 @@ public void SelectUnbanCallback(Database db, DBResultSet results, const char[] e
13191319
} else {
13201320
PrintToServer("%sNo active bans found for that filter", Prefix);
13211321
}
1322+
delete dataPack;
13221323
return;
13231324
}
13241325

@@ -2562,14 +2563,14 @@ stock void UTIL_InsertTempBan(int time, const char[] name, const char[] auth, co
25622563

25632564
ServerCommand(buffer);
25642565

2565-
if (IsClientInGame(client))
2566+
if (IsClientInGame(client))
25662567
{
2567-
char length[32];
2568-
if(time == 0)
2569-
FormatEx(length, sizeof(length), "permament");
2570-
else
2571-
FormatEx(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes");
2572-
KickClient(client, "%t\n\n%t", "Banned Check Site", WebsiteAddress, "Kick Reason", admin, reason, length);
2568+
char length[32];
2569+
if(time == 0)
2570+
FormatEx(length, sizeof(length), "permament");
2571+
else
2572+
FormatEx(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes");
2573+
KickClient(client, "%t\n\n%t", "Banned Check Site", WebsiteAddress, "Kick Reason", admin, reason, length);
25732574
}
25742575

25752576
char banName[128], banReason[256], query[512];
@@ -2651,10 +2652,10 @@ stock void PrepareBan(int client, int target, int time, char[] reason, int size)
26512652
}
26522653
}
26532654
LogAction(client, target, "\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")", client, target, time, reason);
2654-
char length[32];
2655-
if(time == 0)
2656-
FormatEx(length, sizeof(length), "permament");
2657-
else
2655+
char length[32];
2656+
if(time == 0)
2657+
FormatEx(length, sizeof(length), "permament");
2658+
else
26582659
FormatEx(length, sizeof(length), "%d %s", time, time == 1 ? "minute" : "minutes");
26592660
if (time > 5 || time == 0)
26602661
time = 5;

0 commit comments

Comments
 (0)