mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-27 18:38:16 +02:00
cairo_gstate_t contains a cairo_font_options_t. Since commit67eeed44, this can contain an extra allocation for a custom palette. Since commitedf9497c3a, this contains an extra allocation for a string. Before these commit, font options could just be dropped, but now they need to be freed. This commit makes _cairo_gstate_fini() finish the font options to free the memory allocation. The new test was run via "valgrind --leak-check=full ./cairo-test-suite -f leaks-set-scaled-font". The following reported leak goes away thanks to this commit: 1,040 bytes in 26 blocks are definitely lost in loss record 6 of 12 at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4886C62: _cairo_font_options_init_copy (cairo-font-options.c:105) by 0x488C029: _cairo_gstate_set_font_options (cairo-gstate.c:1757) by 0x48841D7: _cairo_default_context_set_scaled_font (cairo-default-context.c:1310) by 0x490809A: cairo_set_scaled_font (cairo.c:3318) by 0x15BF1F: leaks_set_scaled_font (leaks.c:45) by 0x129EF0: cairo_test_for_target (cairo-test.c:938) by 0x12B37F: _cairo_test_context_run_for_target (cairo-test.c:1545) by 0x12C385: _cairo_test_runner_draw (cairo-test-runner.c:258) by 0x12DEB5: main (cairo-test-runner.c:962) Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/795 Signed-off-by: Uli Schlachter <psychon@znc.in>
87 B
1x1px
87 B
1x1px