I have problems with leaks in the pangocairo hello world example.
#include <cairo.h>
#include <pango/pangocairo.h>
int main(int argc, char *argv[])
{
// 0
cairo_surface_t* surface=cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 240, 80);
// 1
cairo_t* cr=cairo_create(surface);
// 2
PangoFontDescription* font_description=pango_font_description_new();
pango_font_description_set_family(font_description,"serif");
pango_font_description_set_weight(font_description,PANGO_WEIGHT_BOLD);
pango_font_description_set_absolute_size(font_description,32*PANGO_SCALE);
// 3
PangoLayout* layout=pango_cairo_create_layout(cr);
pango_layout_set_font_description(layout,font_description);
pango_layout_set_text(layout,"Hello, world",-1);
cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
cairo_move_to (cr, 10.0, 50.0);
pango_cairo_show_layout(cr,layout);
// 3
g_object_unref(layout);
// 2
pango_font_description_free(font_description);
// 1
cairo_destroy (cr);
cairo_surface_write_to_png (surface, "hello.png");
// 0
cairo_surface_destroy (surface);
return 0;
}
Valgrind outputs
==5178== definitely lost: 7,936 bytes in 28 blocks
==5178== indirectly lost: 8,510 bytes in 374 blocks
==5178== possibly lost: 1,514 bytes in 21 blocks
==5178== still reachable: 567,835 bytes in 5,069 block
And complains about libfontconfig, and glib. Are there any missing cleanup above? If not should I care about it (post a bug report), or is it the lazy free policy of the GNOME project that shows up again?