From 24cb2c84746f55d57a81322994526d724bc47710 Mon Sep 17 00:00:00 2001 From: gewlitys Date: Mon, 9 Dec 2002 19:26:42 +0000 Subject: [PATCH] Fixed an unsafe memory freeing git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@384 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/libs/sound/openal/sfx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sc2/src/sc2code/libs/sound/openal/sfx.c b/sc2/src/sc2code/libs/sound/openal/sfx.c index dc23cea0b..12a4842b4 100644 --- a/sc2/src/sc2code/libs/sound/openal/sfx.c +++ b/sc2/src/sc2code/libs/sound/openal/sfx.c @@ -232,6 +232,14 @@ _ReleaseSoundBankData (MEM_HANDLE Snd) sptr = (TFB_SoundSample **)((BYTE *)fxTab + fxTab->StringOffsets[0]); while (snd_ct--) { + int i; + + for (i = 0; i < NUM_SOUNDSOURCES; ++i) + { + if (soundSource[i].sample == (*sptr)) + soundSource[i].sample = NULL; + } + if ((*sptr)->decoder) SoundDecoder_Free ((*sptr)->decoder); alDeleteBuffers ((*sptr)->num_buffers, (*sptr)->buffer);