aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage
diff options
context:
space:
mode:
authorJulien2011-06-05 05:22:40 +0800
committerJulien2011-06-23 15:11:37 +0800
commit367605d774df038166b14044a5f5ce935f244519 (patch)
tree051917f11e3d00cffc4d0deb2e9415b7e69903be /engines/tsage
parent5aa1877beffa71a2cc712a85b74a788e22a924e2 (diff)
downloadscummvm-rg350-367605d774df038166b14044a5f5ce935f244519.tar.gz
scummvm-rg350-367605d774df038166b14044a5f5ce935f244519.tar.bz2
scummvm-rg350-367605d774df038166b14044a5f5ce935f244519.zip
TSAGE: Allocate resource decoding buffer on the heap
Diffstat (limited to 'engines/tsage')
-rw-r--r--engines/tsage/resources.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp
index d24c564a1f..e6a561f3a7 100644
--- a/engines/tsage/resources.cpp
+++ b/engines/tsage/resources.cpp
@@ -237,8 +237,13 @@ byte *TLib::getResource(uint16 id, bool suppressErrors) {
uint16 ctrCurrent = 0x102, ctrMax = 0x200;
uint16 word_48050 = 0, currentToken = 0, word_48054 =0;
byte byte_49068 = 0, byte_49069 = 0;
- DecodeReference table[0x1000];
- for (int i = 0; i < 0x1000; ++i) {
+
+ const uint tableSize = 0x1000;
+ DecodeReference *table = (DecodeReference *)malloc(tableSize * sizeof(DecodeReference));
+ if (!table)
+ error("[TLib::getResource] Cannot allocate table buffer");
+
+ for (int i = 0; i < tableSize; ++i) {
table[i].vByte = table[i].vWord = 0;
}
Common::Stack<uint16> tokenList;
@@ -302,6 +307,8 @@ byte *TLib::getResource(uint16 id, bool suppressErrors) {
}
}
+ free(table);
+
assert(bytesWritten == re->uncompressedSize);
delete compStream;
return dataOut;