aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2010-08-02 22:27:50 +0000
committerJohannes Schickel2010-08-02 22:27:50 +0000
commit0dba655085e3c5f025ae111be4929d5a9250d95a (patch)
tree5cca389a0853f828c262cd9a7d248dfd3ff43941
parentdd38e424e7ec87990019f4a811fdc25c62fe1729 (diff)
downloadscummvm-rg350-0dba655085e3c5f025ae111be4929d5a9250d95a.tar.gz
scummvm-rg350-0dba655085e3c5f025ae111be4929d5a9250d95a.tar.bz2
scummvm-rg350-0dba655085e3c5f025ae111be4929d5a9250d95a.zip
SCI: Fix memory leak.
This was a quite bad leak in gamestate_restore. It was caused by the code only deleting the Graphics::Surface object but not its data. I changed the code to use skipThumbnailHeader now, since the code actually ignores the thumbnail anyway. svn-id: r51667
-rw-r--r--engines/sci/engine/savegame.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 64bd46563a..10a2cbd569 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -748,11 +748,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
}
// We don't need the thumbnail here, so just read it and discard it
- Graphics::Surface *thumbnail = new Graphics::Surface();
- assert(thumbnail);
- Graphics::loadThumbnail(*fh, *thumbnail);
- delete thumbnail;
- thumbnail = 0;
+ Graphics::skipThumbnailHeader(*fh);
s->reset(true);
s->saveLoadWithSerializer(ser); // FIXME: Error handling?