diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-03-28 15:17:27 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-04-03 21:21:44 +0200 |
commit | ef3cfb2a49b5be82d56d783f505319754dc65cb8 (patch) | |
tree | f299436312d6230c08289b61e9bad51a4dd31681 /source/fitz/filter-leech.c | |
parent | d9f0fdfe1ac986816a3376ee0271f84fb549b0bf (diff) | |
download | mupdf-ef3cfb2a49b5be82d56d783f505319754dc65cb8.tar.xz |
Don't implicitly drop in fz_open_* chained filters.
Diffstat (limited to 'source/fitz/filter-leech.c')
-rw-r--r-- | source/fitz/filter-leech.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/source/fitz/filter-leech.c b/source/fitz/filter-leech.c index cc98b972..77485068 100644 --- a/source/fitz/filter-leech.c +++ b/source/fitz/filter-leech.c @@ -41,29 +41,16 @@ static void close_leech(fz_context *ctx, void *state_) { fz_leech *state = (fz_leech *)state_; - fz_drop_stream(ctx, state->chain); + fz_drop_buffer(ctx, state->buffer); fz_free(ctx, state); } fz_stream * fz_open_leecher(fz_context *ctx, fz_stream *chain, fz_buffer *buffer) { - fz_leech *state = NULL; - - fz_var(state); - - fz_try(ctx) - { - state = fz_malloc_struct(ctx, fz_leech); - state->chain = chain; - state->buffer = buffer; - } - fz_catch(ctx) - { - fz_free(ctx, state); - fz_drop_stream(ctx, chain); - fz_rethrow(ctx); - } + fz_leech *state = fz_malloc_struct(ctx, fz_leech); + state->chain = fz_keep_stream(ctx, chain); + state->buffer = fz_keep_buffer(ctx, buffer); return fz_new_stream(ctx, state, next_leech, close_leech); } |