pango_core_text_font_map_load_fontset() memory leak
Submitted by Alan Wang
Link to original bug (#783460)
Description
Created attachment 353241 Changed pangocoretext-fontmap.c file
I found the pango_core_text_font_map_load_fontset() have memory leak.
pango_core_text_font_map_load_fontset (PangoFontMap *fontmap, PangoContext *context, const PangoFontDescription *desc, PangoLanguage *language) { PangoCoreTextFontset fontset; [...] if (G_UNLIKELY (!fontset)) { / If no font(set) could be loaded, we fallback to "Sans", * which should always work on Mac. We try to adhere to the * requested style at first. */ PangoFontDescription *tmp_desc;
/* Cannot use pango_core_text_fontset_key_free() here */
pango_font_description_free (key.desc);
tmp_desc = pango_font_description_copy_static (desc);
/* the tmp_desc variable memory leak */
[...]
/* I add those code to free the tmp_desc memory */ if(tmp_desc) pango_font_description_free(tmp_desc);
}
if (insert_in_hash)
g_hash_table_insert (ctfontmap->fontset_hash,
pango_core_text_fontset_get_key (fontset),
fontset);
}
/* Cannot use pango_core_text_fontset_key_free() here */ pango_font_description_free (key.desc);
return g_object_ref (fontset); }
Attachment 353241, "Changed pangocoretext-fontmap.c file":
pangocoretext-fontmap.c
Version: 1.40.x