aboutsummaryrefslogtreecommitdiff
path: root/engines/teenagent/resources.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/teenagent/resources.cpp')
-rw-r--r--engines/teenagent/resources.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index 9e69383215..597ca670c0 100644
--- a/engines/teenagent/resources.cpp
+++ b/engines/teenagent/resources.cpp
@@ -106,13 +106,20 @@ void Resources::loadOff(Graphics::Surface &surface, byte *palette, int id) {
error("invalid background %d", id);
return;
}
- byte buf[64768];
- off.read(id, buf, sizeof(buf));
+
+ const uint bufferSize = 64768;
+ byte *buf = (byte *)malloc(bufferSize);
+ if (!buf)
+ error("[Resources::loadOff] Cannot allocate buffer");
+
+ off.read(id, buf, bufferSize);
byte *src = buf;
byte *dst = (byte *)surface.pixels;
memcpy(dst, src, 64000);
memcpy(palette, buf + 64000, 768);
+
+ free(buf);
}
Common::SeekableReadStream *Resources::loadLan(uint32 id) const {