[pango/matthiasc/for-master] fc: Plug a memory leak




commit 7b608cd64e586f02870dea31b91ade4f935e3e0c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Aug 30 09:25:40 2020 -0400

    fc: Plug a memory leak
    
    pango_fc_patterns_get_font_pattern() returns a reference
    if prepare is FALSE, and otherwise returns a pointer to
    a pattern that is owned by the fontset. But in that case,
    we call FcFontRenderPrepare, making a new pattern.
    
    In either case, by the time we reach the bottom of
    pango_fc_fontset_load_next_font, font_pattern holds a
    reference we need to free.

 pango/pangofc-fontmap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index eed0960a..e2a4ebd2 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -984,8 +984,7 @@ pango_fc_fontset_load_next_font (PangoFcFontset *fontset)
                                      fontset->key,
                                      font_pattern);
 
-  if (prepare)
-    FcPatternDestroy (font_pattern);
+  FcPatternDestroy (font_pattern);
 
   return font;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]