diff options
author | adnano <me@adnano.co> | 2024-03-02 11:31:13 -0500 |
---|---|---|
committer | adnano <me@adnano.co> | 2024-03-02 11:31:13 -0500 |
commit | f7e6e0b4bf3bca6dbc2b6c7e81cb013be43c6c06 (patch) | |
tree | d2c5629336431b91cdc0c712193da1745a42c08f /pango.c | |
parent | b247119ab3ad46760ac85428309230200d9f6c61 (diff) | |
download | wmenu-f7e6e0b4bf3bca6dbc2b6c7e81cb013be43c6c06.tar.gz |
Free memory associated with the menu on exit
Diffstat (limited to 'pango.c')
-rw-r--r-- | pango.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -13,12 +13,16 @@ int get_font_height(const char *fontstr) { PangoFontDescription *desc = pango_font_description_from_string(fontstr); PangoFont *font = pango_font_map_load_font(fontmap, context, desc); if (font == NULL) { + pango_font_description_free(desc); + g_object_unref(context); return -1; } PangoFontMetrics *metrics = pango_font_get_metrics(font, NULL); int height = pango_font_metrics_get_height(metrics) / PANGO_SCALE; - pango_font_description_free(desc); pango_font_metrics_unref(metrics); + g_object_unref(font); + pango_font_description_free(desc); + g_object_unref(context); return height; } @@ -32,8 +36,8 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, pango_layout_set_font_description(layout, desc); pango_layout_set_single_paragraph_mode(layout, 1); pango_layout_set_attributes(layout, attrs); - pango_attr_list_unref(attrs); pango_font_description_free(desc); + pango_attr_list_unref(attrs); return layout; } |