fluidsynth.c
changeset 561 87bdb4c81c0b
parent 545 32e5ed415a34
child 585 f2943eac3fd7
     1.1 --- a/fluidsynth.c	Fri Jan 13 02:39:41 2012 -0500
     1.2 +++ b/fluidsynth.c	Fri Jan 13 03:15:19 2012 -0500
     1.3 @@ -75,7 +75,7 @@
     1.4  		return NULL;
     1.5  	}
     1.6  
     1.7 -	if ((song = malloc(sizeof(FluidSynthMidiSong)))) {
     1.8 +	if ((song = SDL_malloc(sizeof(FluidSynthMidiSong)))) {
     1.9  		memset(song, 0, sizeof(FluidSynthMidiSong));
    1.10  
    1.11  		if (SDL_BuildAudioCVT(&song->convert, AUDIO_S16, 2, freq, format, channels, freq) >= 0) {
    1.12 @@ -102,7 +102,7 @@
    1.13  		} else {
    1.14  			Mix_SetError("Failed to set up audio conversion");
    1.15  		}
    1.16 -		free(song);
    1.17 +		SDL_free(song);
    1.18  	} else {
    1.19  		Mix_SetError("Insufficient memory for song");
    1.20  	}
    1.21 @@ -121,7 +121,7 @@
    1.22  	size = SDL_RWtell(rw) - offset;
    1.23  	SDL_RWseek(rw, offset, RW_SEEK_SET);
    1.24  
    1.25 -	if ((buffer = (char*) malloc(size))) {
    1.26 +	if ((buffer = (char*) SDL_malloc(size))) {
    1.27  		if(SDL_RWread(rw, buffer, size, 1) == 1) {
    1.28  			if (fluidsynth.fluid_player_add_mem(song->player, buffer, size) == FLUID_OK) {
    1.29  				return 1;
    1.30 @@ -131,7 +131,7 @@
    1.31  		} else {
    1.32  			Mix_SetError("Failed to read in-memory song");
    1.33  		}
    1.34 -		free(buffer);
    1.35 +		SDL_free(buffer);
    1.36  	} else {
    1.37  		Mix_SetError("Insufficient memory for song");
    1.38  	}
    1.39 @@ -155,7 +155,7 @@
    1.40  	fluidsynth.delete_fluid_player(song->player);
    1.41  	fluidsynth.delete_fluid_settings(fluidsynth.fluid_synth_get_settings(song->synth));
    1.42  	fluidsynth.delete_fluid_synth(song->synth);
    1.43 -	free(song);
    1.44 +	SDL_free(song);
    1.45  }
    1.46  
    1.47  void fluidsynth_start(FluidSynthMidiSong *song)
    1.48 @@ -188,7 +188,7 @@
    1.49  	void *src = dest;
    1.50  
    1.51  	if (dest_len < src_len) {
    1.52 -		if (!(src = malloc(src_len))) {
    1.53 +		if (!(src = SDL_malloc(src_len))) {
    1.54  			Mix_SetError("Insufficient memory for audio conversion");
    1.55  			return result;
    1.56  		}
    1.57 @@ -214,7 +214,7 @@
    1.58  
    1.59  finish:
    1.60  	if (src != dest)
    1.61 -		free(src);
    1.62 +		SDL_free(src);
    1.63  
    1.64  	return result;
    1.65  }