[Scummvm-cvs-logs] SF.net SVN: scummvm:[41066] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun May 31 14:28:56 CEST 2009


Revision: 41066
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41066&view=rev
Author:   lordhoto
Date:     2009-05-31 12:28:56 +0000 (Sun, 31 May 2009)

Log Message:
-----------
Fix various memory leaks in Lands of Lore.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/script_lol.cpp
    scummvm/trunk/engines/kyra/staticres.cpp

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-05-31 12:05:49 UTC (rev 41065)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-05-31 12:28:56 UTC (rev 41066)
@@ -408,6 +408,9 @@
 	for (Common::List<Audio::AudioStream *>::iterator i = _speechList.begin(); i != _speechList.end(); ++i)
 		delete *i;
 	_speechList.clear();
+
+	_emc->unload(&_itemScript);
+	_emc->unload(&_scriptData);
 }
 
 Screen *LoLEngine::screen() {

Modified: scummvm/trunk/engines/kyra/script_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lol.cpp	2009-05-31 12:05:49 UTC (rev 41065)
+++ scummvm/trunk/engines/kyra/script_lol.cpp	2009-05-31 12:28:56 UTC (rev 41066)
@@ -39,6 +39,7 @@
 	EMCData scriptData;
 	EMCState scriptState;
 	memset(&scriptData, 0, sizeof(EMCData));
+	_emc->unload(&_scriptData);
 	_emc->load(filename, &scriptData, &_opcodes);
 
 	_emc->init(&scriptState, &scriptData);
@@ -58,6 +59,7 @@
 }
 
 void LoLEngine::runInfScript(const char *filename) {
+	_emc->unload(&_scriptData);
 	_emc->load(filename, &_scriptData, &_opcodes);
 	runLevelScript(0x400, -1);
 }

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2009-05-31 12:05:49 UTC (rev 41065)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2009-05-31 12:28:56 UTC (rev 41066)
@@ -1031,8 +1031,8 @@
 			t->characterUpdateDelay[ii] = file->readByte();
 	};
 
+	delete file;
 	ptr = charData;
-
 	return true;
 }
 
@@ -1060,8 +1060,8 @@
 		t->flags = file->readUint16LE();
 	};
 
+	delete file;
 	ptr = spellData;
-
 	return true;
 }
 
@@ -1082,8 +1082,9 @@
 		t->flags = file->readByte();
 	};
 
+
+	delete file;
 	ptr = defs;
-
 	return true;
 }
 
@@ -1105,8 +1106,8 @@
 		t->flipFlags = file->readByte();
 	};
 
+	delete file;
 	ptr = defs;
-
 	return true;
 }
 
@@ -1123,8 +1124,8 @@
 	for (int i = 0; i < size; i++)
 		r[i] = file->readUint16BE();
 
+	delete file;
 	ptr = r;
-
 	return true;
 }
 
@@ -1141,8 +1142,8 @@
 	for (int i = 0; i < size; i++)
 		r[i] = file->readUint32BE();
 
+	delete file;
 	ptr = r;
-
 	return true;
 }
 
@@ -1168,8 +1169,8 @@
 		r[i].screenDim = file->readUint16BE();
 	}
 
+	delete file;
 	ptr = r;
-
 	return true;
 }
 #endif // ENABLE_LOL


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