Created attachment 117248 [details] plug a memory leak The bug is that in '_emit_recording_surface_pattern' the current cr is saved on the stack in 'old_cr': http://cgit.freedesktop.org/cairo/tree/src/cairo-script-surface.c#n1173 if replaying the recording surface 'emit_source' is called it is possible that the 'current_source' member of surface->cr is finished and in its place is copied the new source, (for surface_patterns this means that the new source surface ref count is incremented): http://cgit.freedesktop.org/cairo/tree/src/cairo-script-surface.c#n1741 but exiting the recursion 'old_cr' is assigned/raw-copied onto surface->cr and current_source is overwritten without the matching ref count decrement. compiling cairo with -fsanitize=address Gcc option and running (cd test; CAIRO_TEST_TARGET=recording ./cairo-test-suite -f user-font-mask ) the report ends with: ... SUMMARY: AddressSanitizer: 7632 byte(s) leaked in 27 allocation(s).
Created attachment 117249 [details] [review] script: Plug a memory leak using recording surfaces and vector glyph Hah, I wrote an almost identical patch!
-- 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/124.
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.