mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-04 10:01:16 +00:00
ramsfont: Fix memory leaks in error paths
patch credit: surabhi-mishra
This commit is contained in:
parent
ccb2875503
commit
aa4d7b06df
1 changed files with 2 additions and 0 deletions
|
@ -98,6 +98,7 @@ fluid_ramsfont_create_sfont()
|
||||||
sfont = FLUID_NEW(fluid_sfont_t);
|
sfont = FLUID_NEW(fluid_sfont_t);
|
||||||
if (sfont == NULL) {
|
if (sfont == NULL) {
|
||||||
FLUID_LOG(FLUID_ERR, "Out of memory");
|
FLUID_LOG(FLUID_ERR, "Out of memory");
|
||||||
|
delete_fluid_ramsfont(ramsfont);
|
||||||
return NULL;
|
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);
|
err = fluid_rampreset_add_sample(preset, sample, lokey, hikey);
|
||||||
if (err != FLUID_OK) {
|
if (err != FLUID_OK) {
|
||||||
|
delete_fluid_rampreset(preset);
|
||||||
return FLUID_FAILED;
|
return FLUID_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue