diff options
author | sapier <Sapier at GMX dot net> | 2013-04-07 21:17:26 +0200 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2013-04-07 23:43:34 -0400 |
commit | e7247c1a66e2a61d5b4a97d9cab02194b97de53b (patch) | |
tree | 5d1b7f851af2fdbbef1472cac3d77356abf48ffb /src | |
parent | 0d26bb36aff7d4b76b0b8df3bd475954bc3867ba (diff) | |
download | minetest-e7247c1a66e2a61d5b4a97d9cab02194b97de53b.tar.gz minetest-e7247c1a66e2a61d5b4a97d9cab02194b97de53b.tar.bz2 minetest-e7247c1a66e2a61d5b4a97d9cab02194b97de53b.zip |
fix memory leak on sound shutdown
Diffstat (limited to 'src')
-rw-r--r-- | src/sound_openal.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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<std::string, std::vector<SoundBuffer*> >::iterator i = m_buffers.begin(); + i != m_buffers.end(); i++) { + for (std::vector<SoundBuffer*>::iterator iter = (*i).second.begin(); + iter != (*i).second.end(); iter++) { + delete *iter; + } + (*i).second.clear(); + } + m_buffers.clear(); infostream<<"Audio: Deinitialized."<<std::endl; } |