Skip to content

Commit

Permalink
Fixed bug 3115 - Double free or corruption when playing some MS ADPCM…
Browse files Browse the repository at this point in the history
… 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 f8bd0f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wavestream.c
Expand Up @@ -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,
Expand Down

0 comments on commit f8bd0f8

Please sign in to comment.