Fixed 1418 - crash on double free if loading WAV file failed
authorSam Lantinga <slouken@libsdl.org>
Sun, 12 Feb 2012 17:57:17 -0500
changeset 5832d713670db9b
parent 582 df72f22b4b41
child 586 c92001a2c18f
Fixed 1418 - crash on double free if loading WAV file failed
mixer.c
     1.1 --- a/mixer.c	Mon Jan 30 21:41:45 2012 -0500
     1.2 +++ b/mixer.c	Sun Feb 12 17:57:17 2012 -0500
     1.3 @@ -610,13 +610,15 @@
     1.4  			break;
     1.5  		default:
     1.6  			SDL_SetError("Unrecognized sound file type");
     1.7 -			return(0);			
     1.8 +			if ( freesrc ) {
     1.9 +				SDL_RWclose(src);
    1.10 +			}
    1.11 +			loaded = NULL;
    1.12 +			break;
    1.13  	}
    1.14  	if ( !loaded ) {
    1.15 +		/* The individual loaders have closed src if needed */
    1.16  		SDL_free(chunk);
    1.17 -		if ( freesrc ) {
    1.18 -			SDL_RWclose(src);
    1.19 -		}
    1.20  		return(NULL);
    1.21  	}
    1.22