Bug 87766

Summary: memory leak in _cairo_default_context_set_source_surface
Product: cairo Reporter: Massimo <sixtysix>
Component: generalAssignee: Chris Wilson <chris>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: testcase

Description Massimo 2014-12-27 15:10:36 UTC
Created attachment 111398 [details]
testcase

running the attached test case valgrind reports:

>==3== 160 bytes in 1 blocks are definitely lost in loss record 1 of 7
>==3==    at 0x4A06BCF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>==3==    by 0x4C645AC: _cairo_pattern_create_solid (cairo/src/cairo-pattern.c:605)
>==3==    by 0x4C645EB: _cairo_pattern_create_in_error.part.20 (cairo/src/cairo-pattern.c:628)
>==3==    by 0x4C3D0E4: _cairo_default_context_set_source_surface (cairo/src/cairo-default-context.c:327)
>==3==    by 0x4C349EE: cairo_set_source_surface (cairo/src/cairo.c:766)
>==3==    by 0x400803: main (/home/massimo/devel/tmp/test-cairo-set-source-surface.c:12)

_cairo_default_context_set_source_surface, when the surface passed in
is in error, returns a pattern->status without destroying the pattern
created which is not a static pattern nor part of a cairo owned set
of error patterns:

http://cgit.freedesktop.org/cairo/tree/src/cairo-default-context.c#n327

Similarly cairo_get_source returns a leaked pattern when the context
passed in is in error:

http://cgit.freedesktop.org/cairo/tree/src/cairo.c#n833

Valgrind reports this one running:

CAIRO_TEST_TARGET=image valgrind --leak-check=full .libs/cairo-test-suite -f  api-special-cases
Comment 1 GitLab Migration User 2018-08-25 13:45:30 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/179.

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.