From b52859323c68fa87a167fed8af5c8f3f945e6cd8 Mon Sep 17 00:00:00 2001 From: David Turner Date: Tue, 25 Jan 2011 08:24:57 +0000 Subject: LASTEXPRESS: Fixed Memory Leak in Subtitles. Also, fixed minor uninitialised read in animation event polling. svn-id: r55524 --- engines/lastexpress/data/animation.cpp | 2 +- engines/lastexpress/game/sound.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp index d105a34f8c..7288889f09 100644 --- a/engines/lastexpress/data/animation.cpp +++ b/engines/lastexpress/data/animation.cpp @@ -286,7 +286,7 @@ void Animation::play() { g_engine->_system->delayMillis(20); // Handle right-click to interrupt animations - Common::Event ev; + Common::Event ev = Common::Event(); while (g_engine->getEventManager()->pollEvent(ev)) { if (ev.type == Common::EVENT_RBUTTONUP) { // Stop audio diff --git a/engines/lastexpress/game/sound.cpp b/engines/lastexpress/game/sound.cpp index 6392efe522..652703c285 100644 --- a/engines/lastexpress/game/sound.cpp +++ b/engines/lastexpress/game/sound.cpp @@ -119,9 +119,12 @@ SoundManager::SoundManager(LastExpressEngine *engine) : _engine(engine), _state( SoundManager::~SoundManager() { for (Common::List::iterator i = _cache.begin(); i != _cache.end(); ++i) SAFE_DELETE(*i); - _cache.clear(); + for (Common::List::iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) + SAFE_DELETE(*i); + _subtitles.clear(); + _currentSubtitle = NULL; // Zero passed pointers -- cgit v1.2.3