From 173b43d487133546bb3657de13168b5fdcdf2c54 Mon Sep 17 00:00:00 2001 From: def Date: Mon, 8 Apr 2019 21:54:12 +0200 Subject: [PATCH] Fix memory leak in draggers --- src/game/server/entities/dragger.cpp | 15 ++++++++------- src/game/server/entities/dragger.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/game/server/entities/dragger.cpp b/src/game/server/entities/dragger.cpp index 1102a8d0c..c47956a32 100644 --- a/src/game/server/entities/dragger.cpp +++ b/src/game/server/entities/dragger.cpp @@ -392,13 +392,14 @@ CDraggerTeam::CDraggerTeam(CGameWorld *pGameWorld, vec2 Pos, float Strength, { for (int i = 0; i < MAX_CLIENTS; ++i) { - m_Draggers[i] = new CDragger(pGameWorld, Pos, Strength, NW, i, Layer, - Number); + m_Draggers[i] = new CDragger(pGameWorld, Pos, Strength, NW, i, Layer, Number); } } -//CDraggerTeam::~CDraggerTeam() { -//for(int i = 0; i < MAX_CLIENTS; ++i) { -// delete m_Draggers[i]; -//} -//} +CDraggerTeam::~CDraggerTeam() +{ + for (int i = 0; i < MAX_CLIENTS; ++i) + { + delete m_Draggers[i]; + } +} diff --git a/src/game/server/entities/dragger.h b/src/game/server/entities/dragger.h index 13c838f72..432fcadcb 100644 --- a/src/game/server/entities/dragger.h +++ b/src/game/server/entities/dragger.h @@ -36,7 +36,7 @@ public: CDraggerTeam(CGameWorld *pGameWorld, vec2 Pos, float Strength, bool NW = false, int Layer = 0, int Number = 0); - //~CDraggerTeam(); + ~CDraggerTeam(); }; #endif // GAME_SERVER_ENTITIES_DRAGGER_H