Skip to content

Commit

Permalink
gl: Fix bug in _cairo_gl_pattern_texture_setup()
Browse files Browse the repository at this point in the history
The memory allocated to "image" at line 298 is not freed before moving to label fail at line 305 and 314.
This patch takes care of this memory leak in above mentioned cases.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91537
Signed-off-by: Sahil Vij <sahil.vij@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
  • Loading branch information
Sahil Vij authored and Bryce Harrington committed Aug 8, 2015
1 parent e40806e commit f6c46d9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cairo-gl-operand.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,17 +301,21 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand,
so we need to release this device while we paint it to the image. */
if (src_is_gl_surface) {
status = _cairo_gl_context_release (ctx, status);
if (unlikely (status))
if (unlikely (status)) {
_cairo_surface_unmap_image (&surface->base, image);
goto fail;
}
}

status = _cairo_surface_offset_paint (&image->base, extents->x, extents->y,
CAIRO_OPERATOR_SOURCE, _src, NULL);

if (src_is_gl_surface) {
status = _cairo_gl_context_acquire (dst->base.device, &ctx);
if (unlikely (status))
if (unlikely (status)) {
_cairo_surface_unmap_image (&surface->base, image);
goto fail;
}
}

status = _cairo_surface_unmap_image (&surface->base, image);
Expand Down

0 comments on commit f6c46d9

Please sign in to comment.