diff options
author | Filippos Karapetis | 2016-12-20 02:13:18 +0200 |
---|---|---|
committer | Filippos Karapetis | 2016-12-20 02:13:18 +0200 |
commit | 8a16f9d7857e517bd2b87744c0bea17fab9d1eb3 (patch) | |
tree | d9d2661107eac443b53c5f71e7ce6a424c8d4d00 /engines/fullpipe | |
parent | 907bab8a015c3d65f71e32297483e402dad62fae (diff) | |
download | scummvm-rg350-8a16f9d7857e517bd2b87744c0bea17fab9d1eb3.tar.gz scummvm-rg350-8a16f9d7857e517bd2b87744c0bea17fab9d1eb3.tar.bz2 scummvm-rg350-8a16f9d7857e517bd2b87744c0bea17fab9d1eb3.zip |
FULLPIPE: Delete temporary memory streams used with MfcArchive
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/stateloader.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index adc4fe3731..86865f928a 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -69,18 +69,21 @@ bool GameLoader::readSavegame(const char *fname) { byte *map = (byte *)malloc(800); saveFile->read(map, 800); - MfcArchive temp(new Common::MemoryReadStream(map, 800)); + Common::MemoryReadStream *tempStream = new Common::MemoryReadStream(map, 800); + MfcArchive temp(tempStream); if (_savegameCallback) _savegameCallback(&temp, false); + delete tempStream; delete saveFile; // Deobfuscate the data for (int i = 0; i < header.encSize; i++) data[i] -= i & 0x7f; - MfcArchive *archive = new MfcArchive(new Common::MemoryReadStream(data, header.encSize)); + Common::MemoryReadStream *archiveStream = new Common::MemoryReadStream(data, header.encSize); + MfcArchive *archive = new MfcArchive(archiveStream); GameVar *var = (GameVar *)archive->readClass(); @@ -91,6 +94,7 @@ bool GameLoader::readSavegame(const char *fname) { if (!v) { warning("No state to save"); + delete archiveStream; delete archive; return false; } @@ -121,6 +125,7 @@ bool GameLoader::readSavegame(const char *fname) { _sc2array[i]._isLoaded = 0; } + delete archiveStream; delete archive; getGameLoaderInventory()->rebuildItemRects(); |