cserve2: fix minor memleaks with fonts

Leaks happen when fonts fail to load
This commit is contained in:
Jean-Philippe Andre 2013-06-20 14:38:42 +09:00 committed by Cedric Bail
parent 9929ee9aec
commit d2c3b67a72
2 changed files with 15 additions and 2 deletions

View File

@ -355,7 +355,13 @@ evas_common_font_int_memory_load(const char *source, const char *name, int size,
fi->cs2_handler = evas_cserve2_font_load(source, name, size, font_dpi,
wanted_rend);
if (fi->cs2_handler)
evas_cserve2_font_load_wait((Font_Entry *)fi->cs2_handler);
{
if (evas_cserve2_font_load_wait((Font_Entry *)fi->cs2_handler) != 0)
{
evas_cserve2_font_free(fi->cs2_handler);
fi->cs2_handler = NULL;
}
}
}
#endif
free(fake_name);
@ -391,7 +397,13 @@ evas_common_font_int_load(const char *name, int size,
fi->cs2_handler = evas_cserve2_font_load(NULL, name, size, font_dpi,
wanted_rend);
if (fi->cs2_handler)
evas_cserve2_font_load_wait((Font_Entry *)fi->cs2_handler);
{
if (evas_cserve2_font_load_wait((Font_Entry *)fi->cs2_handler) != 0)
{
evas_cserve2_font_free(fi->cs2_handler);
fi->cs2_handler = NULL;
}
}
}
#endif
// evas_common_font_int_load_complete(fi);

View File

@ -1165,6 +1165,7 @@ evas_cserve2_font_free(Font_Entry *fe)
if (ret != CSERVE2_NONE)
{
ERR("Failed to wait loading font '%s'.", fe->name);
_font_entry_free(fe);
return;
}