Skip to content

Commit 3678a3f

Browse files
authored
fix: memory leak (#8)
1 parent a904cc2 commit 3678a3f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

addons/sourcemod/scripting/FixSprayExploit.sp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Spray Exploit Fixer
3-
* Copyright (C) 2023 Silvers
3+
* Copyright (C) 2024 Silvers
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
1818

1919

2020

21-
#define PLUGIN_VERSION "2.24"
21+
#define PLUGIN_VERSION "2.25"
2222

2323
/*=======================================================================================
2424
Plugin Info:
@@ -31,6 +31,9 @@
3131
3232
========================================================================================
3333
Change Log:
34+
35+
2.25 (28-Jan-2024)
36+
- Fixed memory leak caused by clearing StringMap/ArrayList data instead of deleting.
3437
2.24 (17-Jul-2023)
3538
- Now less check of GetClientAuthId by storing them. Thanks to ".Rushaway".
3639
@@ -423,8 +426,13 @@ public void OnClientDisconnect(int client)
423426
public void OnMapEnd()
424427
{
425428
MoveSprays();
426-
g_smReceive.Clear();
427-
g_smWaiting.Clear();
429+
// .Clear() is creating a memory leak
430+
// g_smReceive.Clear();
431+
// g_smWaiting.Clear();
432+
delete g_smReceive;
433+
delete g_smWaiting;
434+
g_smReceive = new StringMap();
435+
g_smWaiting = new StringMap();
428436

429437
for( int i = 1; i <= MaxClients; i++ )
430438
{

0 commit comments

Comments
 (0)