Skip to content

Plug a memory leak in an error case

GTK has a testcase that tests the error when creating an oversize image, and asan tells me that it triggers a memory leak in cairo:

Direct leak of 160 byte(s) in 1 object(s) allocated from:
    #0 0x7f1122755667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
    #1 0x7f1120cc83e8 in _cairo_pattern_create_solid ../src/cairo-pattern.c:607
    #2 0x7f1120cc8487 in _cairo_pattern_create_in_error ../src/cairo-pattern.c:630
    #3 0x7f1120cc87cb in INT_cairo_pattern_create_for_surface ../src/cairo-pattern.c:736
    #4 0x7f1120c1f1c7 in _cairo_default_context_set_source_surface ../src/cairo-default-context.c:327
    #5 0x7f1120d8386a in INT_cairo_set_source_surface ../src/cairo.c:982
    #6 0x7f1121d005a2 in gdk_cairo_set_source_pixbuf ../gdk/gdkcairo.c:234
    #7 0x401427 in test_set_source_big_pixbuf ../testsuite/gdk/cairo.c:23
Edited by Uli Schlachter

Merge request reports