[Scummvm-cvs-logs] SF.net SVN: scummvm: [22128] scummvm/trunk/engines/simon/animation.cpp

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sun Apr 23 18:41:02 CEST 2006


Revision: 22128
Author:   kirben
Date:     2006-04-23 18:40:16 -0700 (Sun, 23 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22128&view=rev

Log Message:
-----------
Ooops, real memory leak was in sound buffer

Modified Paths:
--------------
    scummvm/trunk/engines/simon/animation.cpp
Modified: scummvm/trunk/engines/simon/animation.cpp
===================================================================
--- scummvm/trunk/engines/simon/animation.cpp	2006-04-24 01:14:28 UTC (rev 22127)
+++ scummvm/trunk/engines/simon/animation.cpp	2006-04-24 01:40:16 UTC (rev 22128)
@@ -87,8 +87,6 @@
 }
 
 void MoviePlayer::play() {
-	uint32 tag;
-
 	if (_fd.isOpen() == false) {
 		// Load OmniTV video
 		if (_vm->getBitFlag(40)) {
@@ -107,19 +105,20 @@
 	_leftButtonDown = false;
 	_rightButtonDown = false;
 
-	tag = _fd.readUint32BE();
-	assert(tag == MKID_BE('WAVE'));
-
-	uint32 size = _fd.readUint32BE();
-	byte *buffer = (byte *)malloc(size);
-	_fd.read(buffer, size);
-
 	_ticks = _vm->_system->getMillis();
 
-	Common::MemoryReadStream stream(buffer, size);
-	_bgSoundStream = makeWAVStream(stream);
-	_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream);
+	uint32 tag = _fd.readUint32BE();
+	if (tag == MKID_BE('WAVE')) {
+		uint32 size = _fd.readUint32BE();
+		byte *buffer = (byte *)malloc(size);
+		_fd.read(buffer, size);
 
+		Common::MemoryReadStream stream(buffer, size);
+		_bgSoundStream = makeWAVStream(stream);
+		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream);
+		free(buffer);
+	}
+
 	// Resolution is smaller in Amiga verison so always clear screen
 	if (_width == 384 && _height == 280)
 		_vm->dx_clear_surfaces(480);
@@ -173,9 +172,6 @@
 	_fd.close();
 	free(_frameBuffer1);
 	free(_frameBuffer2);
-
-	_mixer->stopHandle(_bgSound);
-	free(_bgSoundStream);
 }
 
 void MoviePlayer::decodeZlib(uint8 *data, int size, int totalSize) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list