Skip to content

Commit

Permalink
Fixed 1418 - crash on double free if loading WAV file failed
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 12, 2012
1 parent 6a2ec29 commit 23b6289
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions mixer.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit 23b6289

Please sign in to comment.