diff options
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() { |