[Scummvm-cvs-logs] SF.net SVN: scummvm:[54659] scummvm/trunk/engines/hugo

tdhs at users.sourceforge.net tdhs at users.sourceforge.net
Tue Nov 30 01:01:55 CET 2010


Revision: 54659
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54659&view=rev
Author:   tdhs
Date:     2010-11-30 00:01:54 +0000 (Tue, 30 Nov 2010)

Log Message:
-----------
HUGO: Close Two Memory Leaks.

Note that the first leak is the allocation of the Common::RandomSource, _rnd. I'm not sure of the effect of deallocating this while it is still registered to g_eventRec, but all other engines seem to be the same (or implicitly do this by making a Common::RandomSource member of the engine object) so this is not a engine specific issue, but should be assessed.

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/hugo.cpp
    scummvm/trunk/engines/hugo/object.cpp

Modified: scummvm/trunk/engines/hugo/hugo.cpp
===================================================================
--- scummvm/trunk/engines/hugo/hugo.cpp	2010-11-29 23:57:15 UTC (rev 54658)
+++ scummvm/trunk/engines/hugo/hugo.cpp	2010-11-30 00:01:54 UTC (rev 54659)
@@ -81,6 +81,7 @@
 	DebugMan.addDebugChannel(kDebugObject, "Object", "Object debug level");
 
 	_console = new HugoConsole(this);
+	_rnd = 0;
 }
 
 HugoEngine::~HugoEngine() {
@@ -167,6 +168,7 @@
 
 	DebugMan.clearAllDebugChannels();
 	delete _console;
+	delete _rnd;
 }
 
 GameType HugoEngine::getGameType() const {

Modified: scummvm/trunk/engines/hugo/object.cpp
===================================================================
--- scummvm/trunk/engines/hugo/object.cpp	2010-11-29 23:57:15 UTC (rev 54658)
+++ scummvm/trunk/engines/hugo/object.cpp	2010-11-30 00:01:54 UTC (rev 54659)
@@ -343,7 +343,12 @@
 * Free ObjectArr (before exiting)
 */
 void ObjectHandler::freeObjectArr() {
+	for(int16 i = 0; i < _objCount; i++) {
+		free(_objects[i].stateDataIndex);
+		_objects[i].stateDataIndex = 0;
+	}
 	free(_objects);
+	_objects = 0;
 }
 
 /**


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