diff options
author | Peter Kohaut | 2019-02-01 23:15:20 +0100 |
---|---|---|
committer | Peter Kohaut | 2019-02-02 00:50:16 +0100 |
commit | a5854b524b4251eb4636063fbee37f07d5f86168 (patch) | |
tree | 4c0dfaaf759bedde56709001dc7812dcd69c4053 | |
parent | 315100861c05365dd27013be1885f2d67c9c032c (diff) | |
download | scummvm-rg350-a5854b524b4251eb4636063fbee37f07d5f86168.tar.gz scummvm-rg350-a5854b524b4251eb4636063fbee37f07d5f86168.tar.bz2 scummvm-rg350-a5854b524b4251eb4636063fbee37f07d5f86168.zip |
BLADERUNNER: Fixed resource leak in game listing
This was causing issues with loading / saving games
-rw-r--r-- | engines/bladerunner/savefile.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/engines/bladerunner/savefile.cpp b/engines/bladerunner/savefile.cpp index 55670a1078..33a91b8b73 100644 --- a/engines/bladerunner/savefile.cpp +++ b/engines/bladerunner/savefile.cpp @@ -31,6 +31,9 @@ #include "graphics/thumbnail.h" + + +#include "common/debug.h" namespace BladeRunner { SaveStateList SaveFileManager::list(const Common::String &target) { @@ -41,6 +44,7 @@ SaveStateList SaveFileManager::list(const Common::String &target) { for (Common::StringArray::const_iterator fileName = files.begin(); fileName != files.end(); ++fileName) { Common::InSaveFile *saveFile = saveFileMan->openForLoading(*fileName); if (saveFile == nullptr || saveFile->err()) { + delete saveFile; continue; } @@ -49,6 +53,8 @@ SaveStateList SaveFileManager::list(const Common::String &target) { int slotNum = atoi(fileName->c_str() + fileName->size() - 3); saveList.push_back(SaveStateDescriptor(slotNum, header._name)); + + delete saveFile; } Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator()); |