Re: [PATCH] gl: Fix bug in _cairo_gl_pattern_texture_setup()

Bryce Harrington <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On Mon, Aug 03, 2015 at 04:46:09PM +0530, Sahil Vij wrote:
> 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 <[email protected]>

LGTM, thanks.
Reviewed-by: Bryce Harrington <[email protected]>

To ssh://git.cairographics.org/git/cairo
   e40806e..f6c46d9  master -> master


> ---
>  src/cairo-gl-operand.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c
> index 4015747..1d1465a 100644
> --- a/src/cairo-gl-operand.c
> +++ b/src/cairo-gl-operand.c
> @@ -301,8 +301,10 @@ _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,
> @@ -310,8 +312,10 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand,
>  
>      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);
> -- 
> 1.7.9.5
> 
> -- 
> cairo mailing list
> [email protected]
> http://lists.cairographics.org/mailman/listinfo/cairo
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.