aboutsummaryrefslogtreecommitdiff
path: root/engines/cruise/dataLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cruise/dataLoader.cpp')
-rw-r--r--engines/cruise/dataLoader.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp
index 94d075ecc3..b2a319bb85 100644
--- a/engines/cruise/dataLoader.cpp
+++ b/engines/cruise/dataLoader.cpp
@@ -265,6 +265,8 @@ int loadFile(const char* name, int idx, int destIdx) {
error("Unknown fileType in loadFile");
}
+ MemFree(ptr);
+
return -1;
}
@@ -283,6 +285,7 @@ int loadFileRange(const char *name, int startIdx, int currentEntryIdx, int numId
for (i = 0; i < numIdx; i++) {
if ((startIdx + i) > numMaxEntriesInSet) {
+ MemFree(ptr);
return 0; // exit if limit is reached
}
loadSetEntry(name, ptr, startIdx + i, currentEntryIdx + i);