Skip to content

Commit

Permalink
Fix a memory leak of FontConfig config
Browse files Browse the repository at this point in the history
The config has to be freed twice, because
pango_fc_font_map_set_config increases the number of references to it.

Related to #2319.
  • Loading branch information
liZe committed Dec 3, 2024
1 parent 2270a9b commit 150dec6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion weasyprint/text/fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def __init__(self):
"""
# Load the main config file and the fonts.
self._config = fontconfig.FcInitLoadConfigAndFonts()
self._config = ffi.gc(
fontconfig.FcInitLoadConfigAndFonts(), fontconfig.FcConfigDestroy)
self.font_map = ffi.gc(
pangoft2.pango_ft2_font_map_new(), gobject.g_object_unref)
pangoft2.pango_fc_font_map_set_config(
Expand Down

0 comments on commit 150dec6

Please sign in to comment.