Bug 5100

Summary: patterns leak
Product: cairo Reporter: Richard Stellingwerff <remenic>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: high    
Version: 1.1.1   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: test-case

Description Richard Stellingwerff 2005-11-20 08:38:18 UTC
The attached test-case shows memory leaking from _cairo_gradient_pattern_init_copy. 

Here's the valgrind output:

==8450== 88 bytes in 1 blocks are definitely lost in loss record 3 of 5
==8450==    at 0x1B902338: malloc (vg_replace_malloc.c:130)
==8450==    by 0x1B9239FE: _cairo_gradient_pattern_init_copy (cairo-pattern.c:166)
==8450==    by 0x1B923B20: _cairo_pattern_init_copy (cairo-pattern.c:205)
==8450==    by 0x1B913F00: _cairo_gstate_copy_transformed_pattern
(cairo-gstate.c:699)
==8450==    by 0x1B913F86: _cairo_gstate_copy_transformed_source
(cairo-gstate.c:713)
==8450==    by 0x1B915772: _cairo_gstate_fill (cairo-gstate.c:1569)
==8450==    by 0x1B90F960: cairo_fill_preserve (cairo.c:1598)
==8450==    by 0x1B90F926: cairo_fill (cairo.c:1576)
==8450==    by 0x80487B0: main (in /home/remenic/cairo-pattern-leak)
Comment 1 Richard Stellingwerff 2005-11-20 08:38:59 UTC
Created attachment 3850 [details]
test-case
Comment 2 Carl Worth 2005-11-22 05:48:43 UTC
Thanks. This is now fixed in CVS:

    2005-11-21  Carl Worth  <cworth@cworth.org>

        * ROADMAP: Add reminder to fix all memory leaks (as determined by
        the test suite) before release 1.2.0.

        * src/cairo-gstate.c: (_cairo_gstate_stroke),
        (_cairo_gstate_fill): Patch leak of patterns as noted in bug #5100
        (thanks to Richard Stellingwerff <remenic@gmail.com>).

Note. You might also find that 'make check-valgrind' in cairo's source tree
is useful for examining memory leaks. Back with 1.0, this check was clean,
but it's obviously not anymore. I've added a note to the cairo 1.2 ROADMAP
that these leaks should all be fixed before that release.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.