From 548961ecc35374da59d5d5f5397c6c5159026e12 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 27 Jan 2006 06:05:03 +0000 Subject: A Fix memory leaks in HE games on exit. svn-id: r20208 --- scumm/scumm.cpp | 3 +++ scumm/sound.cpp | 3 +++ scumm/sprite_he.cpp | 6 ++++++ scumm/sprite_he.h | 1 + 4 files changed, 13 insertions(+) (limited to 'scumm') diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 973bb03615..89275cf53e 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1670,6 +1670,9 @@ ScummEngine_v90he::~ScummEngine_v90he() { if (_heversion >= 98) { delete _logicHE; } + if (_heversion >= 99) { + free(_hePalettes); + } } #endif diff --git a/scumm/sound.cpp b/scumm/sound.cpp index df45982ec5..bcccb6c6c6 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -88,6 +88,9 @@ Sound::Sound(ScummEngine *parent) Sound::~Sound() { stopCDTimer(); delete _sfxFile; + + // HE Specific + free(_heMusic); } void Sound::addSoundToQueue(int sound, int heOffset, int heChannel, int heFlags) { diff --git a/scumm/sprite_he.cpp b/scumm/sprite_he.cpp index 923c7556c4..2057c34b35 100644 --- a/scumm/sprite_he.cpp +++ b/scumm/sprite_he.cpp @@ -36,6 +36,12 @@ namespace Scumm { Sprite::Sprite(ScummEngine_v90he *vm) : _vm(vm) { } +Sprite::~Sprite() { + free(_spriteGroups); + free(_spriteTable); + free(_activeSpritesTable); +} + void ScummEngine_v90he::allocateArrays() { ScummEngine::allocateArrays(); _sprite->allocTables(_numSprites, MAX(64, _numSprites / 4), 64); diff --git a/scumm/sprite_he.h b/scumm/sprite_he.h index 848c3604b4..6cc1db7562 100644 --- a/scumm/sprite_he.h +++ b/scumm/sprite_he.h @@ -102,6 +102,7 @@ class ScummEngine_v90he; class Sprite { public: Sprite(ScummEngine_v90he *vm); + virtual ~Sprite(); SpriteInfo *_spriteTable; SpriteGroup *_spriteGroups; -- cgit v1.2.3