mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 03:18:05 +02:00
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.
This commit is contained in:
parent
507d7ee099
commit
39367b2612
1 changed files with 3 additions and 3 deletions
|
|
@ -901,6 +901,9 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t op,
|
|||
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_trapezoids (cairo_operator_t op,
|
|||
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.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue