From 16fef54ae11e09a94ddef57ccd23e2865e82268b Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 15 Feb 2021 19:09:51 -0800 Subject: [PATCH] Pass 1 to Mix_LoadMUS_RW() in MusicTrack::MusicTrack() This makes the freesrc argument of Mix_LoadMUS_RW() 1 instead of 0. If the argument is nonzero, then the passed SDL_RWops will be automatically freed when m_music is freed, too. I don't know why this was 0 before. Setting it to 1 fixes a memory leak that Valgrind reports (which turns into an actual leak every time custom assets are mounted or unmounted). --- desktop_version/src/SoundSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop_version/src/SoundSystem.cpp b/desktop_version/src/SoundSystem.cpp index 4fdbb1ba..7c77f070 100644 --- a/desktop_version/src/SoundSystem.cpp +++ b/desktop_version/src/SoundSystem.cpp @@ -17,7 +17,7 @@ MusicTrack::MusicTrack(const char* fileName) MusicTrack::MusicTrack(SDL_RWops *rw) { - m_music = Mix_LoadMUS_RW(rw, 0); + m_music = Mix_LoadMUS_RW(rw, 1); m_isValid = true; if(m_music == NULL) {