[Scummvm-cvs-logs] SF.net SVN: scummvm:[51667] scummvm/trunk/engines/sci/engine/savegame.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Aug 3 00:27:51 CEST 2010


Revision: 51667
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51667&view=rev
Author:   lordhoto
Date:     2010-08-02 22:27:50 +0000 (Mon, 02 Aug 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/savegame.cpp

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-08-02 22:27:26 UTC (rev 51666)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-08-02 22:27:50 UTC (rev 51667)
@@ -748,11 +748,7 @@
 	}
 
 	// 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?


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list