aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2007-06-21 17:24:27 +0000
committerTorbjörn Andersson2007-06-21 17:24:27 +0000
commit8e2fd2ee7385c1a089e96d1cef3150637e107e41 (patch)
treee91aca3cb737e775e8cf51924d9f127cbcc3de35
parentc42dada4653f860f45e1b46e4f647041e9116af4 (diff)
downloadscummvm-rg350-8e2fd2ee7385c1a089e96d1cef3150637e107e41.tar.gz
scummvm-rg350-8e2fd2ee7385c1a089e96d1cef3150637e107e41.tar.bz2
scummvm-rg350-8e2fd2ee7385c1a089e96d1cef3150637e107e41.zip
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. svn-id: r27590
-rw-r--r--engines/cine/anim.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp
index 2829a31bc0..12d8f70cd0 100644
--- a/engines/cine/anim.cpp
+++ b/engines/cine/anim.cpp
@@ -681,7 +681,7 @@ void convert8BBP2(byte * dest, byte * source, int16 width, int16 height) {
void loadSet(const char *resourceName) {
animHeader2Struct header2;
int16 foundFileIdx;
- byte *dataPtr;
+ byte *dataPtr, *origDataPtr;
int16 entry;
byte *ptr;
int16 i;
@@ -690,7 +690,7 @@ void loadSet(const char *resourceName) {
byte *startOfDataPtr;
foundFileIdx = findFileInBundle(resourceName);
- dataPtr = readBundleFile(foundFileIdx);
+ origDataPtr = dataPtr = readBundleFile(foundFileIdx);
assert(!memcmp(dataPtr, "SET", 3));
@@ -764,13 +764,13 @@ void loadSet(const char *resourceName) {
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 @@ void loadSetAbs(const char *resourceName, uint16 idx) {
byte *startOfDataPtr;
foundFileIdx = findFileInBundle(resourceName);
- dataPtr = readBundleFile(foundFileIdx);
+ origDataPtr = dataPtr = readBundleFile(foundFileIdx);
assert(!memcmp(dataPtr, "SET", 3));
@@ -853,7 +853,7 @@ void loadSetAbs(const char *resourceName, uint16 idx) {
strcpy(animDataTable[entry].name, currentPartName);
}
- free(dataPtr);
+ free(origDataPtr);
}
void loadSeq(const char *resourceName) {