From 2f6aa0e9e665dc87478afc05d6705420a834e6f1 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Fri, 9 Aug 2013 14:43:30 +0000 Subject: [PATCH] Fix segfault / memory leak in error paths Patch credit: surabhi-mishra --- fluidsynth/src/midi/fluid_seq.c | 1 + fluidsynth/src/synth/fluid_synth.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fluidsynth/src/midi/fluid_seq.c b/fluidsynth/src/midi/fluid_seq.c index 40450284..a724ccdc 100644 --- a/fluidsynth/src/midi/fluid_seq.c +++ b/fluidsynth/src/midi/fluid_seq.c @@ -281,6 +281,7 @@ fluid_sequencer_register_client (fluid_sequencer_t* seq, const char *name, nameCopy = FLUID_STRDUP(name); if (nameCopy == NULL) { fluid_log(FLUID_PANIC, "sequencer: Out of memory\n"); + FLUID_FREE(client); return FLUID_FAILED; } diff --git a/fluidsynth/src/synth/fluid_synth.c b/fluidsynth/src/synth/fluid_synth.c index ab553bcf..3dc94701 100644 --- a/fluidsynth/src/synth/fluid_synth.c +++ b/fluidsynth/src/synth/fluid_synth.c @@ -3115,7 +3115,7 @@ fluid_synth_sfload(fluid_synth_t* synth, const char* filename, int reset_presets if (!sfont_info) { - delete_fluid_sfont (sfont_info->sfont); /* FIXME - Shouldn't fail right? - JG */ + delete_fluid_sfont (sfont); FLUID_API_RETURN(FLUID_FAILED); } @@ -3295,7 +3295,7 @@ fluid_synth_sfreload(fluid_synth_t* synth, unsigned int id) if (!sfont_info) { - delete_fluid_sfont (sfont_info->sfont); /* FIXME - Shouldn't fail right? - JG */ + delete_fluid_sfont (sfont); FLUID_API_RETURN(FLUID_FAILED); }