evas font: Improved safety 57/284957/1
authorMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Thu, 1 Dec 2022 19:21:03 +0000 (20:21 +0100)
committerMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Thu, 1 Dec 2022 19:21:47 +0000 (20:21 +0100)
Change-Id: I8531031a30664bffdefb4c385565c1564b8e4755

src/lib/evas/common/evas_font_load.c
src/lib/evas/common/evas_font_main.c

index dabefde..db1ee5b 100644 (file)
@@ -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;
 
index 6539afb..cb237a5 100644 (file)
@@ -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();