image: Mark the data as owned after stealing the snapshot's image

Victor Goya found that we ended up leaking memory after reading a PNG
into an image surface and drawing that onto a PDF surface. In
particular, he discovered that

commit 0bfd2acd35
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Aug 13 01:34:12 2012 +0100

	xlib: Implement SHM fallbacks and fast upload paths

introduced a path to steal the image data for a snapshot (and thereby
avoid a redundant copy), but that path then lead to the leak of the
"owned" data.

Reported-by: Victor Goya <victor.goya@af83.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-06-20 14:02:14 +01:00
parent f39eef8524
commit e079e4e229

View file

@ -767,7 +767,7 @@ _cairo_image_surface_snapshot (void *abstract_surface)
clone->transparency = image->transparency;
clone->color = image->color;
clone->owns_data = FALSE;
clone->owns_data = TRUE;
return &clone->base;
}