Fix segfault / memory leak in error paths

Patch credit: surabhi-mishra
This commit is contained in:
David Henningsson 2013-08-09 14:43:30 +00:00
parent d7d7fb1103
commit 2f6aa0e9e6
2 changed files with 3 additions and 2 deletions

View file

@ -281,6 +281,7 @@ fluid_sequencer_register_client (fluid_sequencer_t* seq, const char *name,
nameCopy = FLUID_STRDUP(name); nameCopy = FLUID_STRDUP(name);
if (nameCopy == NULL) { if (nameCopy == NULL) {
fluid_log(FLUID_PANIC, "sequencer: Out of memory\n"); fluid_log(FLUID_PANIC, "sequencer: Out of memory\n");
FLUID_FREE(client);
return FLUID_FAILED; return FLUID_FAILED;
} }

View file

@ -3115,7 +3115,7 @@ fluid_synth_sfload(fluid_synth_t* synth, const char* filename, int reset_presets
if (!sfont_info) if (!sfont_info)
{ {
delete_fluid_sfont (sfont_info->sfont); /* FIXME - Shouldn't fail right? - JG */ delete_fluid_sfont (sfont);
FLUID_API_RETURN(FLUID_FAILED); FLUID_API_RETURN(FLUID_FAILED);
} }
@ -3295,7 +3295,7 @@ fluid_synth_sfreload(fluid_synth_t* synth, unsigned int id)
if (!sfont_info) if (!sfont_info)
{ {
delete_fluid_sfont (sfont_info->sfont); /* FIXME - Shouldn't fail right? - JG */ delete_fluid_sfont (sfont);
FLUID_API_RETURN(FLUID_FAILED); FLUID_API_RETURN(FLUID_FAILED);
} }