aboutsummaryrefslogtreecommitdiff
path: root/engines/cine/part.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cine/part.cpp')
-rw-r--r--engines/cine/part.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp
index 18c3a8787e..da7d8aa3c7 100644
--- a/engines/cine/part.cpp
+++ b/engines/cine/part.cpp
@@ -251,8 +251,10 @@ byte *readBundleFile(int16 foundFileIdx) {
assert(foundFileIdx >= 0 && foundFileIdx < numElementInPart);
byte *dataPtr = (byte *)calloc(partBuffer[foundFileIdx].unpackedSize, 1);
if (partBuffer[foundFileIdx].unpackedSize != partBuffer[foundFileIdx].packedSize) {
- readFromPart(foundFileIdx, dataPtr);
- delphineUnpack(dataPtr, dataPtr, partBuffer[foundFileIdx].packedSize);
+ byte *unpackBuffer = (byte *)malloc(partBuffer[foundFileIdx].packedSize);
+ readFromPart(foundFileIdx, unpackBuffer);
+ delphineUnpack(dataPtr, unpackBuffer, partBuffer[foundFileIdx].packedSize);
+ free(unpackBuffer);
} else {
readFromPart(foundFileIdx, dataPtr);
}