From 169f565312a438351a886066f7a497f99ca3f636 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 17 Jun 2015 00:11:41 -0700 Subject: [PATCH] Fixed bug 3018 - Loading MIDI music using FluidSynth leaks memory. 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. --- fluidsynth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fluidsynth.c b/fluidsynth.c index 213944ac..e2454899 100644 --- a/fluidsynth.c +++ b/fluidsynth.c @@ -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");