diff options
author | Eugene Sandulenko | 2016-05-07 10:29:49 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-07 10:29:49 +0200 |
commit | 9fd172cba6de27ce8d6b148b5a45e4c663e2d518 (patch) | |
tree | 5d05e0a41cad2ecc765df0582c803a8a65cc9826 | |
parent | afdbfe4d2f962910a7304394f450fefda2fb1960 (diff) | |
download | scummvm-rg350-9fd172cba6de27ce8d6b148b5a45e4c663e2d518.tar.gz scummvm-rg350-9fd172cba6de27ce8d6b148b5a45e4c663e2d518.tar.bz2 scummvm-rg350-9fd172cba6de27ce8d6b148b5a45e4c663e2d518.zip |
CRUISE: Plug memory leak
-rw-r--r-- | engines/cruise/dataLoader.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp index 7a1258dbde..7d00d0871c 100644 --- a/engines/cruise/dataLoader.cpp +++ b/engines/cruise/dataLoader.cpp @@ -249,9 +249,13 @@ int loadFile(const char* name, int idx, int destIdx) { int numMaxEntriesInSet = getNumMaxEntiresInSet(ptr); if (destIdx > numMaxEntriesInSet) { + MemFree(ptr); return 0; // exit if limit is reached } - return loadSetEntry(name, ptr, destIdx, idx); + int res = loadSetEntry(name, ptr, destIdx, idx); + MemFree(ptr); + + return res; } case type_FNT: { return loadFNTSub(ptr, idx); |