aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostas Nakos2008-08-09 18:12:43 +0000
committerKostas Nakos2008-08-09 18:12:43 +0000
commit71f4a15e4efebf4de7a25d2b09817cf3a5aa51b5 (patch)
tree600993419eec34a04004dd27de0731b7b7ea92ed
parent355f100793c8c8946b5fc418f00b2744cd4b2089 (diff)
downloadscummvm-rg350-71f4a15e4efebf4de7a25d2b09817cf3a5aa51b5.tar.gz
scummvm-rg350-71f4a15e4efebf4de7a25d2b09817cf3a5aa51b5.tar.bz2
scummvm-rg350-71f4a15e4efebf4de7a25d2b09817cf3a5aa51b5.zip
hotfix around drascula mem leak problems. see also bug report
svn-id: r33716
-rw-r--r--common/unarj.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/unarj.cpp b/common/unarj.cpp
index da88c11fc9..9a7766a41f 100644
--- a/common/unarj.cpp
+++ b/common/unarj.cpp
@@ -75,7 +75,7 @@ static uint32 GetCRC(byte *data, int len) {
return CRC ^ 0xFFFFFFFF;
}
-ArjFile::ArjFile() {
+ArjFile::ArjFile() : _uncompressedData(NULL) {
InitCRC();
_isOpen = false;
_fallBack = false;
@@ -256,6 +256,11 @@ bool ArjFile::open(const Common::String &filename) {
_compsize = hdr->compSize;
_origsize = hdr->origSize;
+ // FIXME: This hotfix prevents Drascula from leaking memory.
+ // As far as sanity checks go this is not bad, but the engine should be fixed.
+ if (_uncompressedData)
+ free(_uncompressedData);
+
_uncompressedData = (byte *)malloc(_origsize);
_outstream = new MemoryWriteStream(_uncompressedData, _origsize);