[Scummvm-cvs-logs] SF.net SVN: scummvm: [22659] scummvm/trunk/engines/agi/objects.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Fri May 26 07:01:04 CEST 2006


Revision: 22659
Author:   eriktorbjorn
Date:     2006-05-26 07:00:52 -0700 (Fri, 26 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22659&view=rev

Log Message:
-----------
If a game ends by natural causes, unload_object() will be called twice. Make
sure it doesn't try to free the same memory twice.

Modified Paths:
--------------
    scummvm/trunk/engines/agi/objects.cpp
Modified: scummvm/trunk/engines/agi/objects.cpp
===================================================================
--- scummvm/trunk/engines/agi/objects.cpp	2006-05-26 11:28:03 UTC (rev 22658)
+++ scummvm/trunk/engines/agi/objects.cpp	2006-05-26 14:00:52 UTC (rev 22659)
@@ -127,9 +127,12 @@
 	unsigned int i;
 
 	if (objects != NULL) {
-		for (i = 0; i < game.num_objects; i++)
+		for (i = 0; i < game.num_objects; i++) {
 			free(objects[i].name);
+			objects[i].name = NULL;
+		}
 		free(objects);
+		objects = NULL;
 	}
 }
 


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