[cairo-commit] src/cairo-image-surface.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri Aug 17 06:15:53 PDT 2007
src/cairo-image-surface.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
diff-tree 39367b26120b6e1ad0f556911a49f28ef370115b (from 507d7ee09951a35df8b80f0e1507ba17dbd9bfa9)
Author: Martin Ejdestig <marejde at gmail.com>
Date: Fri Aug 17 02:28:35 2007 +0200
Plug possible leak of pixman_traps in _cairo_image_surface_composite_trapezoids.
If width and height are 0 and pixman_traps is allocated on the heap,
it would leak. Fix by simply checking width and height prior to
allocating pixman_traps.
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 9f933e2..3059e78 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -901,6 +901,9 @@ _cairo_image_surface_composite_trapezoid
int mask_bpp;
int ret, i;
+ if (height == 0 || width == 0)
+ return CAIRO_STATUS_SUCCESS;
+
/* Convert traps to pixman traps */
if (num_traps > ARRAY_LENGTH(stack_traps)) {
pixman_traps = _cairo_malloc_ab (num_traps, sizeof(pixman_trapezoid_t));
@@ -921,9 +924,6 @@ _cairo_image_surface_composite_trapezoid
pixman_traps[i].right.p2.y = _cairo_fixed_to_16_16 (traps[i].right.p2.y);
}
- if (height == 0 || width == 0)
- return CAIRO_STATUS_SUCCESS;
-
/* Special case adding trapezoids onto a mask surface; we want to avoid
* creating an intermediate temporary mask unnecessarily.
*
More information about the cairo-commit
mailing list