aboutsummaryrefslogtreecommitdiff
path: root/engines/cruise
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-11-10 23:44:00 +0100
committerWillem Jan Palenstijn2011-11-10 23:44:00 +0100
commitc79b6afcad0f463e7e1ab4ebe50e36f65abd8e16 (patch)
treefd117b97305b0bc186b204c1833fe6c1e0c0e95b /engines/cruise
parent3fb2776c77798022a949454302c705644cfdd628 (diff)
downloadscummvm-rg350-c79b6afcad0f463e7e1ab4ebe50e36f65abd8e16.tar.gz
scummvm-rg350-c79b6afcad0f463e7e1ab4ebe50e36f65abd8e16.tar.bz2
scummvm-rg350-c79b6afcad0f463e7e1ab4ebe50e36f65abd8e16.zip
CRUISE: Fix OOM checks
Diffstat (limited to 'engines/cruise')
-rw-r--r--engines/cruise/overlay.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp
index 2f4b375865..d618ab5599 100644
--- a/engines/cruise/overlay.cpp
+++ b/engines/cruise/overlay.cpp
@@ -185,11 +185,10 @@ int loadOverlay(const char *scriptName) {
// This memory block will be later passed to a MemoryReadStream, which will dispose of it
unpackedBuffer = (byte *)malloc(unpackedSize);
- memset(unpackedBuffer, 0, unpackedSize);
-
if (!unpackedBuffer) {
return (-2);
}
+ memset(unpackedBuffer, 0, unpackedSize);
if (volumePtrToFileDescriptor[fileIdx].size + 2 != unpackedSize) {
char *pakedBuffer =
@@ -566,11 +565,10 @@ int loadOverlay(const char *scriptName) {
// This memory block will be later passed to a MemoryReadStream, which will dispose of it
unpackedBuffer = (byte *)malloc(unpackedSize);
- memset(unpackedBuffer, 0, unpackedSize);
-
if (!unpackedBuffer) {
return (-2);
}
+ memset(unpackedBuffer, 0, unpackedSize);
if (volumePtrToFileDescriptor[fileIdx].size + 2 !=
unpackedSize) {