Skip to content
Permalink
Browse files

Fixed bug 3115 - Double free or corruption when playing some MS ADPCM…

… files

Vikas

Source SDL_RWops should be deleted in Mix_LoadMUSType_RW() and not in WAVStream_LoadSong_RW.

To fix this, we can have two approaches:
1. Instead of calling WAVStream_FreeSong(wave), call SDL_free(wave), As it was happening in previous version
   -> Patch attached for latest revision(#1aca2b6d570f)

2. Before calling WAVStream_FreeSong(wave), set wave->freesrc to 0
 if (!loaded) {
     wave->freesrc = 0;  // Newly added line
     WAVStream_FreeSong(wave);
     return(NULL);
 }
  • Loading branch information
slouken committed Oct 13, 2017
1 parent 46f0a72 commit f8bd0f8b4fcb4fac6e340489b0bf4094342528a4
Showing with 1 addition and 1 deletion.
  1. +1 −1 wavestream.c
@@ -156,7 +156,7 @@ WAVStream *WAVStream_LoadSong_RW(SDL_RWops *src, int freesrc)
Mix_SetError("Unknown WAVE format");
}
if (!loaded) {
WAVStream_FreeSong(wave);
SDL_free(wave);
return(NULL);
}
SDL_BuildAudioCVT(&wave->cvt,

0 comments on commit f8bd0f8

Please sign in to comment.