diff options
author | Einar Johan Trøan Sømåen | 2012-06-12 19:50:36 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-06-12 19:50:36 +0200 |
commit | 0793c961a4066cc0396e781516d63e88a8f92c97 (patch) | |
tree | eb516c7bf189a48d42c0ed16a015ecb4b16382be /engines/wintermute | |
parent | 2e3aec48adc591d6496823f234631332e2f4af59 (diff) | |
download | scummvm-rg350-0793c961a4066cc0396e781516d63e88a8f92c97.tar.gz scummvm-rg350-0793c961a4066cc0396e781516d63e88a8f92c97.tar.bz2 scummvm-rg350-0793c961a4066cc0396e781516d63e88a8f92c97.zip |
WINTERMUTE: Fix some memory-leaks in BSoundBuffer.
Diffstat (limited to 'engines/wintermute')
-rw-r--r-- | engines/wintermute/Base/BSoundBuffer.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/engines/wintermute/Base/BSoundBuffer.cpp b/engines/wintermute/Base/BSoundBuffer.cpp index bbec1342c3..052dbf98d5 100644 --- a/engines/wintermute/Base/BSoundBuffer.cpp +++ b/engines/wintermute/Base/BSoundBuffer.cpp @@ -112,6 +112,9 @@ HRESULT CBSoundBuffer::LoadFromFile(const char *Filename, bool ForceReload) { }
_stream = Audio::makeVorbisStream(_file, DisposeAfterUse::NO);
+ if (!_stream) {
+ return E_FAIL;
+ }
CBUtils::SetString(&_filename, Filename);
return S_OK;
@@ -182,10 +185,10 @@ HRESULT CBSoundBuffer::Play(bool looping, uint32 startSample) { }
if (_stream) {
if (looping) {
- Audio::AudioStream *loopStream = Audio::makeLoopingAudioStream(_stream, 0);
+ Audio::AudioStream *loopStream = new Audio::LoopingAudioStream(_stream, 0, DisposeAfterUse::NO);
g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, _handle, loopStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES);
} else {
- g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, _handle, _stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES);
+ g_system->getMixer()->playStream(Audio::Mixer::kPlainSoundType, _handle, _stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
}
}
return S_OK;
|