summaryrefslogtreecommitdiff
path: root/src/cairo-bentley-ottmann.c
diff options
context:
space:
mode:
authorBryce Harrington <bryce@bryceharrington.org>2018-06-06 10:32:37 -0700
committerBryce Harrington <bryce@bryceharrington.org>2018-06-13 15:21:50 -0700
commit37655af38d320336fe00894dbc2e47d16ea58497 (patch)
tree75fcc4ac6885902ff65165b0e266b26e7c51b207 /src/cairo-bentley-ottmann.c
parent9d2e3646fa04c98747ae3b05a9be433eda7f2730 (diff)
downloadcairo-37655af38d320336fe00894dbc2e47d16ea58497.tar.gz
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 <bryce@bryceharrington.org> Reviewed-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src/cairo-bentley-ottmann.c')
-rw-r--r--src/cairo-bentley-ottmann.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cairo-bentley-ottmann.c b/src/cairo-bentley-ottmann.c
index 91e41f9c3..afe3a63f5 100644
--- a/src/cairo-bentley-ottmann.c
+++ b/src/cairo-bentley-ottmann.c
@@ -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 *));
}