mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
KYRA: Fix memory leak when a sound is started but no free handles are left.
This commit is contained in:
parent
784cc2bd7f
commit
d8e50b8a03
@ -109,8 +109,14 @@ bool Sound::playVoiceStream(Audio::AudioStream *stream, Audio::SoundHandle *hand
|
||||
while (h < kNumChannelHandles && _mixer->isSoundHandleActive(_soundChannels[h]))
|
||||
++h;
|
||||
|
||||
if (h >= kNumChannelHandles)
|
||||
if (h >= kNumChannelHandles) {
|
||||
// When we run out of handles we need to destroy the stream object,
|
||||
// this is to avoid memory leaks in some scenes where too many sfx
|
||||
// are started.
|
||||
// See bug #3427240 "LOL-CD: Memory leak in caves level 3".
|
||||
delete stream;
|
||||
return false;
|
||||
}
|
||||
|
||||
_mixer->playStream(isSfx ? Audio::Mixer::kSFXSoundType : Audio::Mixer::kSpeechSoundType, &_soundChannels[h], stream, -1, volume);
|
||||
if (handle)
|
||||
|
Loading…
x
Reference in New Issue
Block a user