[Scummvm-cvs-logs] SF.net SVN: scummvm: [27590] scummvm/trunk/engines/cine/anim.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Thu Jun 21 19:24:27 CEST 2007


Revision: 27590
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27590&view=rev
Author:   eriktorbjorn
Date:     2007-06-21 10:24:27 -0700 (Thu, 21 Jun 2007)

Log Message:
-----------
Fixed freeing of invalid pointer, which would cause Operation Stealth to crash.
I don't know if the loadSet() / loadSetAbs() functions are every used in Future
Wars. If so, we should commit this to the branch as well.

Modified Paths:
--------------
    scummvm/trunk/engines/cine/anim.cpp

Modified: scummvm/trunk/engines/cine/anim.cpp
===================================================================
--- scummvm/trunk/engines/cine/anim.cpp	2007-06-21 13:34:07 UTC (rev 27589)
+++ scummvm/trunk/engines/cine/anim.cpp	2007-06-21 17:24:27 UTC (rev 27590)
@@ -681,7 +681,7 @@
 void loadSet(const char *resourceName) {
 	animHeader2Struct header2;
 	int16 foundFileIdx;
-	byte *dataPtr;
+	byte *dataPtr, *origDataPtr;
 	int16 entry;
 	byte *ptr;
 	int16 i;
@@ -690,7 +690,7 @@
 	byte *startOfDataPtr;
 
 	foundFileIdx = findFileInBundle(resourceName);
-	dataPtr = readBundleFile(foundFileIdx);
+	origDataPtr = dataPtr = readBundleFile(foundFileIdx);
 
 	assert(!memcmp(dataPtr, "SET", 3));
 
@@ -764,13 +764,13 @@
 		strcpy(animDataTable[entry].name, currentPartName);
 	}
 
-	free(dataPtr);
+	free(origDataPtr);
 }
 
 void loadSetAbs(const char *resourceName, uint16 idx) {
 	animHeader2Struct header2;
 	int16 foundFileIdx;
-	byte *dataPtr;
+	byte *dataPtr, *origDataPtr;
 	int16 entry;
 	byte *ptr;
 	int16 i;
@@ -779,7 +779,7 @@
 	byte *startOfDataPtr;
 
 	foundFileIdx = findFileInBundle(resourceName);
-	dataPtr = readBundleFile(foundFileIdx);
+	origDataPtr = dataPtr = readBundleFile(foundFileIdx);
 
 	assert(!memcmp(dataPtr, "SET", 3));
 
@@ -853,7 +853,7 @@
 		strcpy(animDataTable[entry].name, currentPartName);
 	}
 
-	free(dataPtr);
+	free(origDataPtr);
 }
 
 void loadSeq(const char *resourceName) {


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