From 71f4a15e4efebf4de7a25d2b09817cf3a5aa51b5 Mon Sep 17 00:00:00 2001 From: Kostas Nakos Date: Sat, 9 Aug 2008 18:12:43 +0000 Subject: hotfix around drascula mem leak problems. see also bug report svn-id: r33716 --- common/unarj.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'common') 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); -- cgit v1.2.3