<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - memory leak"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=91267">91267</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>memory leak
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>cairo
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>xcb backend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>psychon@znc.in
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sixtysix@inwind.it
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>cairo-bugs@cairographics.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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':

<a href="http://cgit.freedesktop.org/cairo/tree/src/cairo-xcb-surface-render.c#n3140">http://cgit.freedesktop.org/cairo/tree/src/cairo-xcb-surface-render.c#n3140</a>

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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>