diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-12-16 16:38:04 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2011-12-16 16:38:04 +0000 |
commit | 0efd7871319442987ee68b199a1ad2404af09a90 (patch) | |
tree | 81e800166e6c2c1f05c7ffe3f29a98ad984a20ce /pdf/pdf_interpret.c | |
parent | 09a016ee7c5c81580b27db3bd193b38cb3bd4f0e (diff) | |
download | mupdf-0efd7871319442987ee68b199a1ad2404af09a90.tar.xz |
Mote memsqueezing fixes.
Diffstat (limited to 'pdf/pdf_interpret.c')
-rw-r--r-- | pdf/pdf_interpret.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c index 674cccc4..14d91d23 100644 --- a/pdf/pdf_interpret.c +++ b/pdf/pdf_interpret.c @@ -843,35 +843,44 @@ static pdf_csi * pdf_new_csi(pdf_xref *xref, fz_device *dev, fz_matrix ctm, char *event) { pdf_csi *csi; + fz_context *ctx = dev->ctx; - csi = fz_malloc_struct(dev->ctx, pdf_csi); - csi->xref = xref; - csi->dev = dev; - csi->event = event; + csi = fz_malloc_struct(ctx, pdf_csi); + fz_try(ctx) + { + csi->xref = xref; + csi->dev = dev; + csi->event = event; - csi->top = 0; - csi->obj = NULL; - csi->name[0] = 0; - csi->string_len = 0; - memset(csi->stack, 0, sizeof csi->stack); + csi->top = 0; + csi->obj = NULL; + csi->name[0] = 0; + csi->string_len = 0; + memset(csi->stack, 0, sizeof csi->stack); - csi->xbalance = 0; - csi->in_text = 0; - csi->in_hidden_ocg = 0; + csi->xbalance = 0; + csi->in_text = 0; + csi->in_hidden_ocg = 0; - csi->path = fz_new_path(xref->ctx); - csi->clip = 0; - csi->clip_even_odd = 0; + csi->path = fz_new_path(ctx); + csi->clip = 0; + csi->clip_even_odd = 0; - csi->text = NULL; - csi->tlm = fz_identity; - csi->tm = fz_identity; - csi->text_mode = 0; - csi->accumulate = 1; + csi->text = NULL; + csi->tlm = fz_identity; + csi->tm = fz_identity; + csi->text_mode = 0; + csi->accumulate = 1; - csi->top_ctm = ctm; - pdf_init_gstate(&csi->gstate[0], ctm); - csi->gtop = 0; + csi->top_ctm = ctm; + pdf_init_gstate(&csi->gstate[0], ctm); + csi->gtop = 0; + } + fz_catch(ctx) + { + fz_free(ctx, csi); + fz_rethrow(ctx); + } return csi; } |