-
Uli Schlachter authored
A scaled font contains font options. Since commit 67eeed44, this can contain an extra allocation for a custom palette. Since commit edf9497c, 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 the relevant code for creating and finishing scaled fonts also clean up the font options. The test added in the previous commit also hits this bug (I only found these leaks accidentially!). Running "valgrind --leak-check=full ./cairo-test-suite -f leaks-set-scaled-font" no longer reports the following after this change: 40 bytes in 1 blocks are definitely lost in loss record 1 of 11 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 0x48DAFFB: _cairo_scaled_font_init_key (cairo-scaled-font.c:675) by 0x48DC077: cairo_scaled_font_create (cairo-scaled-font....
7bf743a9