From e7247c1a66e2a61d5b4a97d9cab02194b97de53b Mon Sep 17 00:00:00 2001 From: sapier Date: Sun, 7 Apr 2013 21:17:26 +0200 Subject: fix memory leak on sound shutdown --- src/sound_openal.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/sound_openal.cpp b/src/sound_openal.cpp index cc5261eae..0cfbc2798 100644 --- a/src/sound_openal.cpp +++ b/src/sound_openal.cpp @@ -271,6 +271,16 @@ public: m_context = NULL; alcCloseDevice(m_device); m_device = NULL; + + for (std::map >::iterator i = m_buffers.begin(); + i != m_buffers.end(); i++) { + for (std::vector::iterator iter = (*i).second.begin(); + iter != (*i).second.end(); iter++) { + delete *iter; + } + (*i).second.clear(); + } + m_buffers.clear(); infostream<<"Audio: Deinitialized."<