diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-04-05 18:01:54 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-04-05 18:26:34 +0100 |
commit | e7b13e1de4b29f36ed536bb863e5d81768550490 (patch) | |
tree | 82b9645887a4eb1223f49e76f4f8872204019fa0 /draw | |
parent | ff55e72b741b955bbd0e23bd9d724c6682a181ac (diff) | |
download | mupdf-e7b13e1de4b29f36ed536bb863e5d81768550490.tar.xz |
Fix potential problems on malloc failure.
Don't reset the size of arrays until we have successfully resized them.
Diffstat (limited to 'draw')
-rw-r--r-- | draw/draw_edge.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/draw/draw_edge.c b/draw/draw_edge.c index 12ba72fc..53b67b73 100644 --- a/draw/draw_edge.c +++ b/draw/draw_edge.c @@ -307,8 +307,9 @@ fz_insert_gel_raw(fz_gel *gel, int x0, int y0, int x1, int y1) if (y1 > gel->bbox.y1) gel->bbox.y1 = y1; if (gel->len + 1 == gel->cap) { - gel->cap = gel->cap + 512; - gel->edges = fz_resize_array(gel->ctx, gel->edges, gel->cap, sizeof(fz_edge)); + int new_cap = gel->cap + 512; + gel->edges = fz_resize_array(gel->ctx, gel->edges, new_cap, sizeof(fz_edge)); + gel->cap = new_cap; } edge = &gel->edges[gel->len++]; |