From 0dba655085e3c5f025ae111be4929d5a9250d95a Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 2 Aug 2010 22:27:50 +0000 Subject: 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 --- engines/sci/engine/savegame.cpp | 6 +----- 1 file changed, 1 insertion(+), 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? -- cgit v1.2.3