Skip to content

Commit

Permalink
Fixed bug 3018 - Loading MIDI music using FluidSynth leaks memory.
Browse files Browse the repository at this point in the history
Philipp Wiesemann

There is a memory leak in fluidsynth.c and fluidsynth_loadsong_RW_internal(). The allocated temporary buffer is not deleted if fluid_player_add_mem() returns FLUID_OK.
  • Loading branch information
slouken committed Jun 17, 2015
1 parent 0d01421 commit 169f565
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fluidsynth.c
Expand Up @@ -124,6 +124,7 @@ static int fluidsynth_loadsong_RW_internal(FluidSynthMidiSong *song, void *data)
if ((buffer = (char*) SDL_malloc(size))) {
if(SDL_RWread(src, buffer, size, 1) == 1) {
if (fluidsynth.fluid_player_add_mem(song->player, buffer, size) == FLUID_OK) {
SDL_free(buffer);
return 1;
} else {
Mix_SetError("FluidSynth failed to load in-memory song");
Expand Down

0 comments on commit 169f565

Please sign in to comment.