From: Michal Szczecinski Date: Thu, 1 Dec 2022 19:21:03 +0000 (+0100) Subject: evas font: Improved safety X-Git-Tag: accepted/tizen/unified/20221206.100443~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0b6694c3bb4882fd64cf9a100fb19519dd95325;p=platform%2Fupstream%2Fefl.git evas font: Improved safety Change-Id: I8531031a30664bffdefb4c385565c1564b8e4755 --- diff --git a/src/lib/evas/common/evas_font_load.c b/src/lib/evas/common/evas_font_load.c index dabefde..db1ee5b 100644 --- a/src/lib/evas/common/evas_font_load.c +++ b/src/lib/evas/common/evas_font_load.c @@ -950,6 +950,7 @@ evas_common_font_glyph_lru_remove(RGBA_Font_Glyph *fg) { int size; + if (!fg) return; if (!fg->in_lru) return; if (!font_glyph_lru && !font_color_glyph_lru) return; diff --git a/src/lib/evas/common/evas_font_main.c b/src/lib/evas/common/evas_font_main.c index 6539afb..cb237a5 100644 --- a/src/lib/evas/common/evas_font_main.c +++ b/src/lib/evas/common/evas_font_main.c @@ -869,6 +869,7 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt idx) ******************************************************************/ ERR("Failed to load a glyph using FT_Load_Glyph for idx[%d]. fg_from_fash[%d]", idx, fg_from_fash); if (fg) free(fg); + fg = NULL; /******* * END * *******/ @@ -929,6 +930,7 @@ evas_common_font_int_cache_glyph_get(RGBA_Font_Int *fi, FT_UInt idx) if (error) { free(fg); + fg = NULL; if (!fi->fash) fi->fash = _fash_gl_new(); if (fi->fash) _fash_gl_add(fi->fash, idx, (void *)(-1)); return NULL; @@ -1030,6 +1032,7 @@ evas_common_font_int_cache_glyph_render(RGBA_Font_Glyph *fg) if (!fi->fash) fi->fash = _fash_gl_new(); if (fi->fash) _fash_gl_add(fi->fash, fg->index, (void *)(-1)); free(fg); + fg = NULL; return EINA_FALSE; } FTUNLOCK();