wavestream.c
changeset 561 87bdb4c81c0b
parent 542 3de4970b36d4
child 601 05123263dab3
child 876 fab846266822
     1.1 --- a/wavestream.c	Fri Jan 13 02:39:41 2012 -0500
     1.2 +++ b/wavestream.c	Fri Jan 13 03:15:19 2012 -0500
     1.3 @@ -126,7 +126,7 @@
     1.4  		}
     1.5  		return(NULL);
     1.6  	}
     1.7 -	wave = (WAVStream *)malloc(sizeof *wave);
     1.8 +	wave = (WAVStream *)SDL_malloc(sizeof *wave);
     1.9  	if ( wave ) {
    1.10  		memset(wave, 0, (sizeof *wave));
    1.11  		wave->freerw = freerw;
    1.12 @@ -141,7 +141,7 @@
    1.13  			Mix_SetError("Unknown WAVE format");
    1.14  		}
    1.15  		if ( wave->rw == NULL ) {
    1.16 -			free(wave);
    1.17 +			SDL_free(wave);
    1.18  			if ( freerw ) {
    1.19  				SDL_RWclose(rw);
    1.20  			}
    1.21 @@ -181,10 +181,10 @@
    1.22  			if ( music->cvt.len != original_len ) {
    1.23  				int worksize;
    1.24  				if ( music->cvt.buf != NULL ) {
    1.25 -					free(music->cvt.buf);
    1.26 +					SDL_free(music->cvt.buf);
    1.27  				}
    1.28  				worksize = original_len*music->cvt.len_mult;
    1.29 -				music->cvt.buf=(Uint8 *)malloc(worksize);
    1.30 +				music->cvt.buf=(Uint8 *)SDL_malloc(worksize);
    1.31  				if ( music->cvt.buf == NULL ) {
    1.32  					return 0;
    1.33  				}
    1.34 @@ -238,12 +238,12 @@
    1.35  	if ( wave ) {
    1.36  		/* Clean up associated data */
    1.37  		if ( wave->cvt.buf ) {
    1.38 -			free(wave->cvt.buf);
    1.39 +			SDL_free(wave->cvt.buf);
    1.40  		}
    1.41  		if ( wave->freerw ) {
    1.42  			SDL_RWclose(wave->rw);
    1.43  		}
    1.44 -		free(wave);
    1.45 +		SDL_free(wave);
    1.46  	}
    1.47  }
    1.48  
    1.49 @@ -264,14 +264,14 @@
    1.50  	chunk->magic	= SDL_ReadLE32(src);
    1.51  	chunk->length	= SDL_ReadLE32(src);
    1.52  	if ( read_data ) {
    1.53 -		chunk->data = (Uint8 *)malloc(chunk->length);
    1.54 +		chunk->data = (Uint8 *)SDL_malloc(chunk->length);
    1.55  		if ( chunk->data == NULL ) {
    1.56  			Mix_SetError("Out of memory");
    1.57  			return(-1);
    1.58  		}
    1.59  		if ( SDL_RWread(src, chunk->data, chunk->length, 1) != 1 ) {
    1.60  			Mix_SetError("Couldn't read chunk");
    1.61 -			free(chunk->data);
    1.62 +			SDL_free(chunk->data);
    1.63  			return(-1);
    1.64  		}
    1.65  	} else {
    1.66 @@ -312,7 +312,7 @@
    1.67  	do {
    1.68  		/* FIXME! Add this logic to SDL_LoadWAV_RW() */
    1.69  		if ( chunk.data ) {
    1.70 -			free(chunk.data);
    1.71 +			SDL_free(chunk.data);
    1.72  		}
    1.73  		lenread = ReadChunk(src, &chunk, 1);
    1.74  		if ( lenread < 0 ) {
    1.75 @@ -324,7 +324,7 @@
    1.76  	/* Decode the audio data format */
    1.77  	format = (WaveFMT *)chunk.data;
    1.78  	if ( chunk.magic != FMT ) {
    1.79 -		free(chunk.data);
    1.80 +		SDL_free(chunk.data);
    1.81  		Mix_SetError("Complex WAVE files not supported");
    1.82  		was_error = 1;
    1.83  		goto done;
    1.84 @@ -369,7 +369,7 @@
    1.85  
    1.86  done:
    1.87  	if ( format != NULL ) {
    1.88 -		free(format);
    1.89 +		SDL_free(format);
    1.90  	}
    1.91  	if ( was_error ) {
    1.92  		return NULL;