[RQ170526-01074] gl:Fix bug in _cairo_gl_pattern_texture_setup() 87/136887/1 accepted/tizen/4.0/unified/20170816.011202 accepted/tizen/4.0/unified/20170816.014621 accepted/tizen/unified/20170705.163138 submit/tizen/20170705.043917 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170814.115522 submit/tizen_4.0_unified/20170814.115522
authorMoonhee Choi <mh0310.choi@samsung.com>
Mon, 3 Jul 2017 09:17:32 +0000 (18:17 +0900)
committerMoonhee Choi <mh0310.choi@samsung.com>
Mon, 3 Jul 2017 09:17:32 +0000 (18:17 +0900)
  - The "image" allocated at line 786 is not freed before moving to label fail at line 803.
  - It was fixed in community: https://bugs.freedesktop.org/show_bug.cgi?id=91537

Change-Id: I91833b0f7be723f050e7c1d38ae64e5f07d831fe

src/cairo-gl-operand.c

index de3cee7..0d5c053 100644 (file)
@@ -790,12 +790,18 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand,
     if (src_is_gl_surface) {
        status = _cairo_gl_context_release (ctx, status);
        if (unlikely (status))
+       {
+           _cairo_surface_unmap_image (&surface->base, image);
            goto fail;
+       }
 
        /* we need to release one more time */
        status = _cairo_gl_context_release (ctx, status);
        if (unlikely (status))
+       {
+           _cairo_surface_unmap_image (&surface->base, image);
            goto fail;
+       }
     }
 
     status = _cairo_surface_offset_paint (&image->base, extents->x, extents->y,
@@ -833,7 +839,7 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand,
 
 fail:
     cairo_surface_destroy (&surface->base);
-    cairo_surface_destroy (&image->base);
+
     return status;
 }