summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-op-filter.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-06-28 00:54:54 +0800
committerSebastian Rasmussen <sebras@gmail.com>2017-07-06 22:02:23 +0800
commit479abb72606f6326e7d91a448fbc472c8c3e6b09 (patch)
treec1398ab965bd95a006f9d37f7e0787004f2d1f72 /source/pdf/pdf-op-filter.c
parent4ce3416885d6f4f2e7238af4d6f67d1e7746f871 (diff)
downloadmupdf-479abb72606f6326e7d91a448fbc472c8c3e6b09.tar.xz
Drop pdf processor graphics state upon error.
Diffstat (limited to 'source/pdf/pdf-op-filter.c')
-rw-r--r--source/pdf/pdf-op-filter.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/pdf/pdf-op-filter.c b/source/pdf/pdf-op-filter.c
index a71f2fa7..60d3abe3 100644
--- a/source/pdf/pdf-op-filter.c
+++ b/source/pdf/pdf-op-filter.c
@@ -1287,12 +1287,20 @@ pdf_new_filter_processor(fz_context *ctx, pdf_processor *chain, pdf_obj *old_rdb
proc->old_rdb = old_rdb;
proc->new_rdb = new_rdb;
- proc->gstate = fz_malloc_struct(ctx, filter_gstate);
- proc->gstate->ctm = fz_identity;
- proc->gstate->current_ctm = fz_identity;
+ fz_try(ctx)
+ {
+ proc->gstate = fz_malloc_struct(ctx, filter_gstate);
+ proc->gstate->ctm = fz_identity;
+ proc->gstate->current_ctm = fz_identity;
- proc->gstate->stroke = proc->gstate->stroke;
- proc->gstate->current_stroke = proc->gstate->stroke;
+ proc->gstate->stroke = proc->gstate->stroke;
+ proc->gstate->current_stroke = proc->gstate->stroke;
+ }
+ fz_catch(ctx)
+ {
+ pdf_drop_processor(ctx, (pdf_processor *) proc);
+ fz_rethrow(ctx);
+ }
return (pdf_processor*)proc;
}