[Scummvm-cvs-logs] SF.net SVN: scummvm:[45142] scummvm/trunk/engines/draci
spalek at users.sourceforge.net
spalek at users.sourceforge.net
Fri Oct 16 02:09:20 CEST 2009
Revision: 45142
http://scummvm.svn.sourceforge.net/scummvm/?rev=45142&view=rev
Author: spalek
Date: 2009-10-16 00:09:20 +0000 (Fri, 16 Oct 2009)
Log Message:
-----------
Fix memory leaks when reading thumbnails
Modified Paths:
--------------
scummvm/trunk/engines/draci/detection.cpp
scummvm/trunk/engines/draci/saveload.cpp
Modified: scummvm/trunk/engines/draci/detection.cpp
===================================================================
--- scummvm/trunk/engines/draci/detection.cpp 2009-10-16 00:09:09 UTC (rev 45141)
+++ scummvm/trunk/engines/draci/detection.cpp 2009-10-16 00:09:20 UTC (rev 45142)
@@ -146,10 +146,10 @@
if (Draci::readSavegameHeader(in, header)) {
saveList.push_back(SaveStateDescriptor(slotNum, header.saveName));
if (header.thumbnail) {
- header.thumbnail->free();
- delete header.thumbnail;
- }
- }
+ header.thumbnail->free();
+ delete header.thumbnail;
+ }
+ }
delete in;
}
}
Modified: scummvm/trunk/engines/draci/saveload.cpp
===================================================================
--- scummvm/trunk/engines/draci/saveload.cpp 2009-10-16 00:09:09 UTC (rev 45141)
+++ scummvm/trunk/engines/draci/saveload.cpp 2009-10-16 00:09:20 UTC (rev 45142)
@@ -62,6 +62,7 @@
// Get the thumbnail
header.thumbnail = new Graphics::Surface();
if (!Graphics::loadThumbnail(*in, *header.thumbnail)) {
+ header.thumbnail->free();
delete header.thumbnail;
header.thumbnail = NULL;
return false;
@@ -131,8 +132,13 @@
// Skip over the savegame header
DraciSavegameHeader header;
- readSavegameHeader(f, header);
- if (header.thumbnail) delete header.thumbnail;
+ if (!readSavegameHeader(f, header)) {
+ return Common::kNoGameDataFoundError;
+ }
+ if (header.thumbnail) {
+ header.thumbnail->free();
+ delete header.thumbnail;
+ }
// Pre-processing
vm->_game->rememberRoomNumAsPrevious();
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