Commit 37655af3 authored by Bryce Harrington's avatar Bryce Harrington
Browse files

bo: Check null return from _cairo_malloc_ab() (CID #1159556)



_cairo_malloc_ab() can return NULL under some circumstances, and all
other callers of this routine in the Cairo codebase check its return, so
do so here as well.

Coverity ID: #1159556
Signed-off-by: Bryce Harrington's avatarBryce Harrington <bryce@bryceharrington.org>
Reviewed-by: Uli Schlachter's avatarUli Schlachter <psychon@znc.in>
parent 9d2e3646
......@@ -1484,10 +1484,13 @@ _cairo_bentley_ottmann_tessellate_polygon (cairo_traps_t *traps,
ymin = _cairo_fixed_integer_floor (polygon->limit.p1.y);
ymax = _cairo_fixed_integer_ceil (polygon->limit.p2.y) - ymin;
if (ymax > 64)
if (ymax > 64) {
event_y = _cairo_malloc_ab(sizeof (cairo_bo_event_t*), ymax);
else
if (unlikely (event_y == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
} else {
event_y = stack_event_y;
}
memset (event_y, 0, ymax * sizeof(cairo_bo_event_t *));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment