summaryrefslogtreecommitdiff
path: root/source/fitz/filter-dct.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-03-28 15:17:27 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-04-03 21:21:44 +0200
commitef3cfb2a49b5be82d56d783f505319754dc65cb8 (patch)
treef299436312d6230c08289b61e9bad51a4dd31681 /source/fitz/filter-dct.c
parentd9f0fdfe1ac986816a3376ee0271f84fb549b0bf (diff)
downloadmupdf-ef3cfb2a49b5be82d56d783f505319754dc65cb8.tar.xz
Don't implicitly drop in fz_open_* chained filters.
Diffstat (limited to 'source/fitz/filter-dct.c')
-rw-r--r--source/fitz/filter-dct.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/source/fitz/filter-dct.c b/source/fitz/filter-dct.c
index 644d0dfc..a3ada67e 100644
--- a/source/fitz/filter-dct.c
+++ b/source/fitz/filter-dct.c
@@ -317,29 +317,17 @@ skip:
fz_stream *
fz_open_dctd(fz_context *ctx, fz_stream *chain, int color_transform, int l2factor, fz_stream *jpegtables)
{
- fz_dctd *state = NULL;
+ fz_dctd *state = fz_malloc_struct(ctx, fz_dctd);
- fz_var(state);
+ state->ctx = ctx;
+ state->color_transform = color_transform;
+ state->init = 0;
+ state->l2factor = l2factor;
+ state->cinfo.client_data = NULL;
- fz_try(ctx)
- {
- state = fz_malloc_struct(ctx, fz_dctd);
- state->ctx = ctx;
- state->chain = chain;
- state->jpegtables = jpegtables;
- state->curr_stm = chain;
- state->color_transform = color_transform;
- state->init = 0;
- state->l2factor = l2factor;
- state->cinfo.client_data = NULL;
- }
- fz_catch(ctx)
- {
- fz_free(ctx, state);
- fz_drop_stream(ctx, chain);
- fz_drop_stream(ctx, jpegtables);
- fz_rethrow(ctx);
- }
+ state->chain = fz_keep_stream(ctx, chain);
+ state->jpegtables = fz_keep_stream(ctx, jpegtables);
+ state->curr_stm = state->chain;
return fz_new_stream(ctx, state, next_dctd, close_dctd);
}