diff options
author | Travis Howell | 2006-04-24 01:40:16 +0000 |
---|---|---|
committer | Travis Howell | 2006-04-24 01:40:16 +0000 |
commit | 7d975539c2214f7c726f00b92f62ec63c53d10f0 (patch) | |
tree | fcc516e82d3cf3cbf6e0980e50c69845b2921453 /engines | |
parent | ea3cdb1ed4b7020acaf18579b9bbfe50af2599c6 (diff) | |
download | scummvm-rg350-7d975539c2214f7c726f00b92f62ec63c53d10f0.tar.gz scummvm-rg350-7d975539c2214f7c726f00b92f62ec63c53d10f0.tar.bz2 scummvm-rg350-7d975539c2214f7c726f00b92f62ec63c53d10f0.zip |
Ooops, real memory leak was in sound buffer
svn-id: r22128
Diffstat (limited to 'engines')
-rw-r--r-- | engines/simon/animation.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/engines/simon/animation.cpp b/engines/simon/animation.cpp index 4df1d8bb11..fa457f68d8 100644 --- a/engines/simon/animation.cpp +++ b/engines/simon/animation.cpp @@ -87,8 +87,6 @@ bool MoviePlayer::load(const char *filename) { } void MoviePlayer::play() { - uint32 tag; - if (_fd.isOpen() == false) { // Load OmniTV video if (_vm->getBitFlag(40)) { @@ -107,18 +105,19 @@ void MoviePlayer::play() { _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) @@ -173,9 +172,6 @@ void MoviePlayer::close() { _fd.close(); free(_frameBuffer1); free(_frameBuffer2); - - _mixer->stopHandle(_bgSound); - free(_bgSoundStream); } void MoviePlayer::decodeZlib(uint8 *data, int size, int totalSize) { |