diff options
author | David Turner | 2011-01-27 14:07:45 +0000 |
---|---|---|
committer | David Turner | 2011-01-27 14:07:45 +0000 |
commit | 0760c929082f8a7d4fd99cf90d095d7b0ee4685b (patch) | |
tree | f03bd63d0d14534a0ec08435d590dc81084fd056 /engines | |
parent | eb3667d7c9efcefe3a9e4e57edc3aefa603d6416 (diff) | |
download | scummvm-rg350-0760c929082f8a7d4fd99cf90d095d7b0ee4685b.tar.gz scummvm-rg350-0760c929082f8a7d4fd99cf90d095d7b0ee4685b.tar.bz2 scummvm-rg350-0760c929082f8a7d4fd99cf90d095d7b0ee4685b.zip |
DRASCULA: Fix Memory Leak in drascula.dat Loading.
svn-id: r55566
Diffstat (limited to 'engines')
-rw-r--r-- | engines/drascula/drascula.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index cf0453b87c..258619fe40 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -1041,25 +1041,22 @@ char **DrasculaEngine::loadTexts(Common::File &in) { for (int lang = 0; lang < _numLangs; lang++) { entryLen = in.readUint16BE(); - pos = (char *)malloc(entryLen); if (lang == _lang) { - res[0] = pos; - in.read(res[0], entryLen); - } else { + pos = (char *)malloc(entryLen); in.read(pos, entryLen); - } - - pos += DATAALIGNMENT; + res[0] = pos; + pos += DATAALIGNMENT; - for (int i = 1; i < numTexts; i++) { - pos -= 2; + for (int i = 1; i < numTexts; i++) { + pos -= 2; - len = READ_BE_UINT16(pos); - pos += 2 + len; + len = READ_BE_UINT16(pos); + pos += 2 + len; - if (lang == _lang) res[i] = pos; - } + } + } else + in.seek(entryLen, SEEK_CUR); } return res; |