From 7486ee867e875eb3eba358fd8cb6142c4901c99f Mon Sep 17 00:00:00 2001 From: HMH Date: Fri, 21 Jul 2017 16:37:23 +0200 Subject: [PATCH] also Unload Sound --- src/engine/client/sound.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp index b58d39d41..436568747 100644 --- a/src/engine/client/sound.cpp +++ b/src/engine/client/sound.cpp @@ -348,6 +348,12 @@ int CSound::Update() int CSound::Shutdown() { + + for(unsigned SampleID = 0; SampleID < NUM_SAMPLES; SampleID++) + { + UnloadSample(SampleID); + } + SDL_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO); lock_destroy(m_SoundLock); @@ -684,7 +690,8 @@ void CSound::UnloadSample(int SampleID) return; Stop(SampleID); - mem_free(m_aSamples[SampleID].m_pData); + if (m_aSamples[SampleID].m_pData != 0x0) + mem_free(m_aSamples[SampleID].m_pData); m_aSamples[SampleID].m_pData = 0x0; }