From aa4d7b06df9ce81e5ac2f9f819336eb4080f0ebb Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Wed, 17 Jul 2013 11:28:48 +0000 Subject: [PATCH] ramsfont: Fix memory leaks in error paths patch credit: surabhi-mishra --- fluidsynth/src/sfloader/fluid_ramsfont.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fluidsynth/src/sfloader/fluid_ramsfont.c b/fluidsynth/src/sfloader/fluid_ramsfont.c index 4478a30a..a76044c9 100644 --- a/fluidsynth/src/sfloader/fluid_ramsfont.c +++ b/fluidsynth/src/sfloader/fluid_ramsfont.c @@ -98,6 +98,7 @@ fluid_ramsfont_create_sfont() sfont = FLUID_NEW(fluid_sfont_t); if (sfont == NULL) { FLUID_LOG(FLUID_ERR, "Out of memory"); + delete_fluid_ramsfont(ramsfont); return NULL; } @@ -368,6 +369,7 @@ fluid_ramsfont_add_izone(fluid_ramsfont_t* sfont, unsigned int bank, err = fluid_rampreset_add_sample(preset, sample, lokey, hikey); if (err != FLUID_OK) { + delete_fluid_rampreset(preset); return FLUID_FAILED; }