diff options
author | Julien Templier | 2010-11-11 06:18:23 +0000 |
---|---|---|
committer | Julien Templier | 2010-11-11 06:18:23 +0000 |
commit | 6711c5a8cf48c579bb4b972d4717fb6f1a394320 (patch) | |
tree | 546bb986c01d19c9a375dda3a17341e1fe2d906a /engines | |
parent | da33617061d3d35becaaa741c8144377bf40f39b (diff) | |
download | scummvm-rg350-6711c5a8cf48c579bb4b972d4717fb6f1a394320.tar.gz scummvm-rg350-6711c5a8cf48c579bb4b972d4717fb6f1a394320.tar.bz2 scummvm-rg350-6711c5a8cf48c579bb4b972d4717fb6f1a394320.zip |
LASTEXPRESS: Fix more memory leaks
- Missing deallocation of queued frames in SceneManager
- Leaking functor on each call to entity setup functions
- Add SoundEntry destructor & better Entity cleanup
as reported by digitall
svn-id: r54196
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lastexpress/entities/entity.cpp | 4 | ||||
-rw-r--r-- | engines/lastexpress/entities/entity_intern.h | 2 | ||||
-rw-r--r-- | engines/lastexpress/game/scenes.cpp | 4 | ||||
-rw-r--r-- | engines/lastexpress/game/sound.h | 5 |
4 files changed, 13 insertions, 2 deletions
diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp index 3291b49e9b..6ca0155dcb 100644 --- a/engines/lastexpress/entities/entity.cpp +++ b/engines/lastexpress/entities/entity.cpp @@ -150,7 +150,9 @@ Entity::Entity(LastExpressEngine *engine, EntityIndex index) : _engine(engine), Entity::~Entity() { for (uint i = 0; i < _callbacks.size(); i++) - delete _callbacks[i]; + SAFE_DELETE(_callbacks[i]); + + _callbacks.clear(); delete _data; diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h index 71607ed511..6f80d29d8c 100644 --- a/engines/lastexpress/entities/entity_intern.h +++ b/engines/lastexpress/entities/entity_intern.h @@ -83,7 +83,7 @@ void class::setup_##name() { \ } #define BEGIN_SETUP(class, name, index, type) \ - _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, new ENTITY_CALLBACK(class, name, this)); \ + _engine->getGameLogic()->getGameState()->getGameSavePoints()->setCallback(_entityIndex, _callbacks[index]); \ _data->setCurrentCallback(index); \ _data->resetCurrentParameters<type>(); diff --git a/engines/lastexpress/game/scenes.cpp b/engines/lastexpress/game/scenes.cpp index cf50d3e425..3f9aa0b3b3 100644 --- a/engines/lastexpress/game/scenes.cpp +++ b/engines/lastexpress/game/scenes.cpp @@ -62,6 +62,10 @@ SceneManager::~SceneManager() { SAFE_DELETE(_clockHours); SAFE_DELETE(_clockMinutes); + // Clear frame queue + for (Common::List<SequenceFrame *>::iterator i = _queue.begin(); i != _queue.end(); ++i) + SAFE_DELETE(*i); + // Zero-out passed pointers _engine = NULL; } diff --git a/engines/lastexpress/game/sound.h b/engines/lastexpress/game/sound.h index 8c5c6aea0d..cf08cd7ee8 100644 --- a/engines/lastexpress/game/sound.h +++ b/engines/lastexpress/game/sound.h @@ -284,6 +284,11 @@ private: isStreamed = false; } + + ~SoundEntry() { + delete stream; + //delete subtitle; + } }; // Engine |