aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorTorbjörn Andersson2013-04-27 06:38:48 +0200
committerTorbjörn Andersson2013-04-27 06:38:48 +0200
commitb77a5164142b6b54d461175f639218af4255a897 (patch)
treef4e3bae49c18ebd6405cc76bd1af68086e4ea50b /engines/saga
parent81f5a89093f2923d372fe7a7ad06db7ed30e8731 (diff)
downloadscummvm-rg350-b77a5164142b6b54d461175f639218af4255a897.tar.gz
scummvm-rg350-b77a5164142b6b54d461175f639218af4255a897.tar.bz2
scummvm-rg350-b77a5164142b6b54d461175f639218af4255a897.zip
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.
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/sndres.cpp9
-rw-r--r--engines/saga/sndres.h1
2 files changed, 10 insertions, 0 deletions
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);