[Scummvm-cvs-logs] scummvm master -> b77a5164142b6b54d461175f639218af4255a897

eriktorbjorn eriktorbjorn at telia.com
Sat Apr 27 06:41:17 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b77a516414 SAGA: Fix memory leak in Mac version of IHNM


Commit: b77a5164142b6b54d461175f639218af4255a897
    https://github.com/scummvm/scummvm/commit/b77a5164142b6b54d461175f639218af4255a897
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2013-04-26T21:38:48-07:00

Commit Message:
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.

Changed paths:
    engines/saga/sndres.cpp
    engines/saga/sndres.h



diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp
index 7104403..49d2475 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 bc38bed..979c028 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);






More information about the Scummvm-git-logs mailing list