<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 in recording_pattern_get_surface"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=87898">87898</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Memory leak in recording_pattern_get_surface
          </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>xlib backend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>chris@chris-wilson.co.uk
          </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

cairo-test-suite -f record-extend-none-similar

valgrind reports:

<span class="quote">>==1== 1,392 bytes in 3 blocks are definitely lost in loss record 1 of 7
>==1==    at 0x4A06BCF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>==1==    by 0x4C7042D: _cairo_recording_surface_snapshot (cairo/src/cairo-recording-surface.c:1427)
>==1==    by 0x4C842BE: _cairo_surface_snapshot_copy_on_write (cairo/src/cairo-surface-snapshot.c:189)
>==1==    by 0x4C7E7E0: _cairo_surface_detach_snapshot (cairo/src/cairo-surface.c:348)
>==1==    by 0x4C7E55B: _cairo_surface_detach_snapshots (cairo/src/cairo-surface.c:333)
>==1==    by 0x4C7E55B: _cairo_surface_flush (cairo/src/cairo-surface.c:1545)
>==1==    by 0x4C7E6CC: _cairo_surface_finish_snapshots (cairo/src/cairo-surface.c:1017)
>==1==    by 0x4C7E6CC: cairo_surface_destroy (cairo/src/cairo-surface.c:961)
>==1==    by 0x4C625A7: cairo_pattern_destroy (cairo/src/cairo-pattern.c:1131)
>==1==    by 0x4C3FAC6: _cairo_gstate_fini (cairo/src/cairo-gstate.c:225)
>==1==    by 0x4C3C68C: _cairo_default_context_fini (cairo/src/cairo-default-context.c:75)
>==1==    by 0x4C3C708: _cairo_default_context_destroy (cairo/src/cairo-default-context.c:93)
>==1==    by 0x43E576: record_get (cairo/test/record-extend.c:158)
>==1==    by 0x43E576: record_replay (cairo/test/record-extend.c:173)
>==1==    by 0x40E22D: cairo_test_for_target (cairo/test/cairo-test.c:929)
>==1==    by 0x40E22D: _cairo_test_context_run_for_target (cairo/test/cairo-test.c:1532)
>==1==    by 0x40B6C0: _cairo_test_runner_draw (cairo/test/cairo-test-runner.c:255)
>==1==    by 0x40B6C0: main (cairo/test/cairo-test-runner.c:937)</span >

apparently  '_cairo_surface_snapshot_get_target' increases the target
ref_count:

<a href="http://cgit.freedesktop.org/cairo/tree/src/cairo-surface-snapshot-inline.h#n55">http://cgit.freedesktop.org/cairo/tree/src/cairo-surface-snapshot-inline.h#n55</a>

so in 'recording_pattern_get_surface' in src/cairo-xlib-source.c it is
necessary
to decrease it to match the behaviour of the 2 other possible code paths:

<a href="http://cgit.freedesktop.org/cairo/tree/src/cairo-xlib-source.c#n875">http://cgit.freedesktop.org/cairo/tree/src/cairo-xlib-source.c#n875</a></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>