From b77a5164142b6b54d461175f639218af4255a897 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 27 Apr 2013 06:38:48 +0200 Subject: SAGA: Fix memory leak in Mac version of IHNM CID 1004123. Unfortunately, I do not have this version of the game so I cannot verify that this fix is correct, but it should be. --- engines/saga/sndres.cpp | 9 +++++++++ engines/saga/sndres.h | 1 + 2 files changed, 10 insertions(+) (limited to 'engines/saga') diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 71044034d7..49d24753a1 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -104,6 +104,15 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm), _sfxContext(NULL), _voiceContext(NULL) } } +SndRes::~SndRes() { +#ifdef ENABLE_IHNM + if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) { + // Delete the dummy voice context. See setVoiceBank() + delete _voiceContext; + } +#endif +} + void SndRes::setVoiceBank(int serial) { Common::File *file; if (_voiceSerial == serial) diff --git a/engines/saga/sndres.h b/engines/saga/sndres.h index bc38bed431..979c0288f6 100644 --- a/engines/saga/sndres.h +++ b/engines/saga/sndres.h @@ -39,6 +39,7 @@ class SndRes { public: SndRes(SagaEngine *vm); + ~SndRes(); void playSound(uint32 resourceId, int volume, bool loop); void playVoice(uint32 resourceId); -- cgit v1.2.3