fix memory leaks during sfont loading

This commit is contained in:
derselbst 2018-04-21 16:48:56 +02:00
parent 08147cc3d6
commit 71592ec679
2 changed files with 8 additions and 7 deletions

View file

@ -81,20 +81,20 @@ fluid_sfont_t* fluid_defsfloader_load(fluid_sfloader_t* loader, const char* file
fluid_defsfont_sfont_delete);
if (sfont == NULL)
{
return NULL;
}
defsfont->sfont = sfont;
if (fluid_defsfont_load(defsfont, &loader->file_callbacks, filename) == FLUID_FAILED) {
delete_fluid_defsfont(defsfont);
return NULL;
}
fluid_sfont_set_iteration_start(sfont, fluid_defsfont_sfont_iteration_start);
fluid_sfont_set_iteration_next(sfont, fluid_defsfont_sfont_iteration_next);
fluid_sfont_set_data(sfont, defsfont);
defsfont->sfont = sfont;
if (fluid_defsfont_load(defsfont, &loader->file_callbacks, filename) == FLUID_FAILED) {
fluid_sfont_delete_internal(sfont);
return NULL;
}
return sfont;
}

View file

@ -95,6 +95,7 @@ fluid_ramsfont_create_sfont()
fluid_ramsfont_sfont_delete);
if (sfont == NULL)
{
delete_fluid_ramsfont(ramsfont);
return NULL;
}