From b92bd245c8b1311b6cd63171611e47a6468e410f Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sun, 24 Feb 2013 15:23:34 -0500 Subject: [PATCH] fix 4 MB memory leak on every save --- src/client/GameSave.cpp | 10 ++++++++++ src/game/GameModel.cpp | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index af8bbf2a6..f50d8bd04 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -2064,6 +2064,16 @@ fin: free(partsSaveIndex); if (soapLinkData) free(soapLinkData); + if (partsPosData) + free(partsPosData); + if (partsPosFirstMap) + free(partsPosFirstMap); + if (partsPosLastMap) + free(partsPosLastMap); + if (partsPosCount) + free(partsPosCount); + if (partsPosLink) + free(partsPosLink); return (char*)outputData; } diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index bc8ec4fda..0dbf2f7bf 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -175,6 +175,10 @@ GameModel::~GameModel() { delete brushList[i]; } + for(std::deque::iterator iter = history.begin(), end = history.end(); iter != end; ++iter) + { + delete *iter; + } delete sim; delete ren; if(placeSave)