config: silence valgrind-detected leak in config_font_parse()

This commit is contained in:
Daniel Eklöf 2025-07-11 16:47:51 +02:00
parent aa579acd6e
commit 693aefa96a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -3956,9 +3956,10 @@ config_font_parse(const char *pattern, struct config_font *font)
* both "size" and "pixelsize" being set, and we don't know * both "size" and "pixelsize" being set, and we don't know
* which one takes priority. * which one takes priority.
*/ */
FcConfig *fc_conf = FcConfigCreate();
FcPattern *pat_copy = FcPatternDuplicate(pat); FcPattern *pat_copy = FcPatternDuplicate(pat);
if (pat_copy == NULL || if (pat_copy == NULL ||
!FcConfigSubstitute(NULL, pat_copy, FcMatchPattern)) !FcConfigSubstitute(fc_conf, pat_copy, FcMatchPattern))
{ {
LOG_WARN("%s: failed to do config substitution", pattern); LOG_WARN("%s: failed to do config substitution", pattern);
} else { } else {
@ -3967,6 +3968,7 @@ config_font_parse(const char *pattern, struct config_font *font)
} }
FcPatternDestroy(pat_copy); FcPatternDestroy(pat_copy);
FcConfigDestroy(fc_conf);
if (have_pt_size != FcResultMatch && have_px_size != FcResultMatch) if (have_pt_size != FcResultMatch && have_px_size != FcResultMatch)
pt_size = 8.0; pt_size = 8.0;