diff options
author | Bryce Harrington <bryce@bryceharrington.org> | 2018-06-12 14:23:40 -0700 |
---|---|---|
committer | Bryce Harrington <bryce@bryceharrington.org> | 2018-06-13 15:21:50 -0700 |
commit | 9c56502e064b7896207a80e45c519ad4847e231c (patch) | |
tree | 70704f8e6ed86cbcae6881746829a0dc985639ce /src/cairo-bentley-ottmann.c | |
parent | 1c3ecfac133e5f284934fef9af988405e24347da (diff) | |
download | cairo-9c56502e064b7896207a80e45c519ad4847e231c.tar.gz |
bo: Free event_y in case of error to prevent memory leak (CID ##1160682)
If the call to _cairo_malloc_ab_plus_c() fails, it returns an error
without first freeing event_y.
Coverity ID: #1160682
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.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cairo-bentley-ottmann.c b/src/cairo-bentley-ottmann.c index afe3a63f5..2011e73bd 100644 --- a/src/cairo-bentley-ottmann.c +++ b/src/cairo-bentley-ottmann.c @@ -1501,8 +1501,11 @@ _cairo_bentley_ottmann_tessellate_polygon (cairo_traps_t *traps, sizeof (cairo_bo_start_event_t) + sizeof (cairo_bo_event_t *), sizeof (cairo_bo_event_t *)); - if (unlikely (events == NULL)) + if (unlikely (events == NULL)) { + if (event_y != stack_event_y) + free (event_y); return _cairo_error (CAIRO_STATUS_NO_MEMORY); + } event_ptrs = (cairo_bo_event_t **) (events + num_events); } |