summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-01-04 23:14:21 -0500
committerMatthias Clasen <mclasen@redhat.com>2018-01-05 07:59:28 -0500
commit694cb9ee0af00c38e036bf693d01ae9739e68f2b (patch)
tree1e2cfceaf1d4c0c7e8057dc0a182b35136d26b13
parent6193498961cd334086c3d665d1d856454e16d1b4 (diff)
downloadpango-694cb9ee0af00c38e036bf693d01ae9739e68f2b.tar.gz
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.
-rw-r--r--pango/pangofc-fontmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 0f3a08d0..9ed9d959 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);
}