[Scummvm-cvs-logs] scummvm master -> 83d4eeadc63d40a465ca9713194505440253d398

digitall digitall at scummvm.org
Wed Mar 28 01:12:13 CEST 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
83d4eeadc6 CGE: Close memory leak in savegame thumbnail loading.


Commit: 83d4eeadc63d40a465ca9713194505440253d398
    https://github.com/scummvm/scummvm/commit/83d4eeadc63d40a465ca9713194505440253d398
Author: D G Turner (digitall at scummvm.org)
Date: 2012-03-27T16:10:56-07:00

Commit Message:
CGE: Close memory leak in savegame thumbnail loading.

Changed paths:
    engines/cge/cge_main.cpp
    engines/cge/detection.cpp



diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index fd7dd85..27bc47b 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -430,11 +430,8 @@ bool CGEEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &heade
 
 	// Get the thumbnail
 	header.thumbnail = Graphics::loadThumbnail(*in);
-	if (!header.thumbnail) {
-		delete header.thumbnail;
-		header.thumbnail = NULL;
+	if (!header.thumbnail)
 		return false;
-	}
 
 	// Read in save date/time
 	header.saveYear = in->readSint16LE();
diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp
index b3ef31f..f723ec8 100644
--- a/engines/cge/detection.cpp
+++ b/engines/cge/detection.cpp
@@ -177,7 +177,10 @@ SaveStateList CGEMetaEngine::listSaves(const char *target) const {
 					// Valid savegame
 					if (CGE::CGEEngine::readSavegameHeader(file, header)) {
 						saveList.push_back(SaveStateDescriptor(slotNum, header.saveName));
-						delete header.thumbnail;
+						if (header.thumbnail) {
+							header.thumbnail->free();
+							delete header.thumbnail;
+						}
 					}
 				} else {
 					// Must be an original format savegame






More information about the Scummvm-git-logs mailing list