ports/devel/sdl-mixer/patches/patch-mixer_c

24 lines
552 B
Text

Fix crash on double free if loading WAV file failed.
--- mixer.c.orig Fri Jun 1 02:35:52 2012
+++ mixer.c Fri Jun 1 02:37:01 2012
@@ -610,13 +610,15 @@ Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int freesrc)
break;
default:
SDL_SetError("Unrecognized sound file type");
- return(0);
+ if ( freesrc ) {
+ SDL_RWclose(src);
+ }
+ loaded = NULL;
+ break;
}
if ( !loaded ) {
+ /* The individual loaders have closed src if needed */
SDL_free(chunk);
- if ( freesrc ) {
- SDL_RWclose(src);
- }
return(NULL);
}