[cairo-bugs] [Bug 91267] New: memory leak

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Jul 8 04:48:12 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=91267

            Bug ID: 91267
           Summary: memory leak
           Product: cairo
           Version: unspecified
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: xcb backend
          Assignee: psychon at znc.in
          Reporter: sixtysix at inwind.it
        QA Contact: cairo-bugs at cairographics.org

Running:

( cd test; DISPLAY=:2 CAIRO_TEST_TARGET=xcb valgrind --leak-check=full
.libs/cairo-test-suite -f random-clip )

valgrind reports:

 ==475== 6,160 (144 direct, 6,016 indirect) bytes in 2 blocks are definitely
lost in loss record 10 of 10
==475==    at 0x4A06C10: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==475==    by 0x4C353FA: _cairo_clip_create (cairo/src/cairo-clip.c:111)
==475==    by 0x4C35649: _cairo_clip_copy (cairo/src/cairo-clip.c:151)
==475==    by 0x4C36F73: _cairo_clip_copy_intersect_rectangle
(cairo/src/cairo-clip-inline.h:58)
==475==    by 0x4C36F73: _cairo_clip_reduce_to_rectangle
(cairo/src/cairo-clip-boxes.c:559)
==475==    by 0x4C381E2: _cairo_composite_rectangles_intersect_mask_extents
(cairo/src/cairo-composite-rectangles.c:292)
==475==    by 0x4CBB06A: trim_extents_to_traps
(cairo/src/cairo-xcb-surface-render.c:2859)
==475==    by 0x4CBB06A: _composite_polygon
(cairo/src/cairo-xcb-surface-render.c:3065)
==475==    by 0x4CBA529: _clip_and_composite_boxes
(cairo/src/cairo-xcb-surface-render.c:3141)
==475==    by 0x4CBC5ED: _cairo_xcb_render_compositor_paint
(cairo/src/cairo-xcb-surface-render.c:3556)
==475==    by 0x4C38CE8: _cairo_compositor_paint
(cairo/src/cairo-compositor.c:65)
==475==    by 0x4C7EB40: _cairo_surface_paint (cairo/src/cairo-surface.c:2117)
==475==    by 0x4C4062E: _cairo_gstate_paint (cairo/src/cairo-gstate.c:1067)
==475==    by 0x4C33BC4: cairo_paint (cairo/src/cairo.c:2003)
==475==    by 0x439B3C: draw (cairo/test/random-clips.c:221)
==475==    by 0x40E5F1: cairo_test_for_target (cairo/test/cairo-test.c:929)
==475==    by 0x40E5F1: _cairo_test_context_run_for_target
(cairo/test/cairo-test.c:1532)
==475==    by 0x40BA53: _cairo_test_runner_draw
(cairo/test/cairo-test-runner.c:255)
==475==    by 0x40BA53: main (cairo/test/cairo-test-runner.c:937)

In '_clip_and_composite_boxes':

http://cgit.freedesktop.org/cairo/tree/src/cairo-xcb-surface-render.c#n3140

A copy (intersected with 'boxes') of extents->clip is assigned to 
extents->clip which is passed to '_composite_polygon', when
'_composite_polygon' changes again extents->clip, it destroys the previous
copy and places there a new one (simplified or whatever), this new one
is leaked because at line 3147 rather then assign it to 'clip' which
will be destroyed few lines later, NULL is assigned to 'clip' and the next
line extents->clip is overwritten with the original.

My suggestion here is to assign extents->clip to 'clip' at line 3147.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo-bugs/attachments/20150708/28b6a599/attachment.html>


More information about the cairo-bugs mailing list