[pango] Avoid a memory leak



commit 694cb9ee0af00c38e036bf693d01ae9739e68f2b
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jan 4 23:14:21 2018 -0500

    Avoid a memory leak
    
    We call pango_fc_font_key_init on a stack-allocated temporary
    lookup key, with the expectation that it does not have to be
    freed. In the case where we want to use it as key in the font_hash,
    we call copy() on it. So, don't duplicate the variations string
    in init() - it will get duplicated in copy() later.

 pango/pangofc-fontmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 0f3a08d..9ed9d95 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -656,7 +656,7 @@ pango_fc_font_key_init (PangoFcFontKey    *key,
   key->fontmap = fcfontmap;
   key->pattern = pattern;
   key->matrix = *pango_fc_fontset_key_get_matrix (fontset_key);
-  key->variations = g_strdup (fontset_key->variations);
+  key->variations = fontset_key->variations;
   key->context_key = pango_fc_fontset_key_get_context_key (fontset_key);
 }
 


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