diff options
author | David Turner | 2010-11-07 21:08:46 +0000 |
---|---|---|
committer | David Turner | 2010-11-07 21:08:46 +0000 |
commit | 4acad22d6e28d647c3233c183e3104b9d02a86e5 (patch) | |
tree | 33f9b7326b1aaa02d4a4baf11eca18ebcacb0ba6 /engines/toon/anim.cpp | |
parent | ce733ab75a9af19fe203930b37f9fc7fb8712cae (diff) | |
download | scummvm-rg350-4acad22d6e28d647c3233c183e3104b9d02a86e5.tar.gz scummvm-rg350-4acad22d6e28d647c3233c183e3104b9d02a86e5.tar.bz2 scummvm-rg350-4acad22d6e28d647c3233c183e3104b9d02a86e5.zip |
TOON: Corrections to close some memory leaks.
These corrections close a number of leaks in the Toon engine reported by running Valgrind with --leak-check=full option.
svn-id: r54127
Diffstat (limited to 'engines/toon/anim.cpp')
-rw-r--r-- | engines/toon/anim.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp index 53980e3dc1..169d53de5d 100644 --- a/engines/toon/anim.cpp +++ b/engines/toon/anim.cpp @@ -58,6 +58,7 @@ bool Animation::loadAnimation(Common::String file) { uint8 *currentData = fileData + 68; if (_paletteEntries) { if (paletteSize) { + delete[] _palette; _palette = new uint8[paletteSize]; memcpy(_palette, currentData, paletteSize); currentData += paletteSize; @@ -74,6 +75,7 @@ bool Animation::loadAnimation(Common::String file) { if (READ_LE_UINT32(finalBuffer) == 0x12345678) { uint8 *data = finalBuffer; + delete[] _frames; _frames = new AnimationFrame[_numFrames]; for (int32 e = 0; e < _numFrames; e++) { if (READ_LE_UINT32(data) != 0x12345678) @@ -111,8 +113,9 @@ bool Animation::loadAnimation(Common::String file) { } Animation::Animation(ToonEngine *vm) : _vm(vm) { - _palette = 0; - _frames = 0; + _palette = NULL; + _numFrames = 0; + _frames = NULL; } Animation::~Animation() { |