summaryrefslogtreecommitdiff
path: root/source/fitz/filter-sgi.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2018-09-26 01:42:03 +0800
committerTor Andersson <tor.andersson@artifex.com>2018-10-23 18:46:01 +0200
commit048d147bc43935f56da577c22a2dce553cc4203b (patch)
treed1ba89f2eda842f0dfd263c9981c38231d57f676 /source/fitz/filter-sgi.c
parentbf169f823f4feefa3572a143f12d297d49863c0e (diff)
downloadmupdf-048d147bc43935f56da577c22a2dce553cc4203b.tar.xz
Fix cleanup upon exception in the tiff filters.
Diffstat (limited to 'source/fitz/filter-sgi.c')
-rw-r--r--source/fitz/filter-sgi.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/source/fitz/filter-sgi.c b/source/fitz/filter-sgi.c
index fdd7a1e1..ef59ee57 100644
--- a/source/fitz/filter-sgi.c
+++ b/source/fitz/filter-sgi.c
@@ -311,9 +311,8 @@ close_sgilog16(fz_context *ctx, void *state_)
fz_stream *
fz_open_sgilog16(fz_context *ctx, fz_stream *chain, int w)
{
- fz_sgilog16 *state = NULL;
+ fz_sgilog16 *state = fz_malloc_struct(ctx, fz_sgilog16);
- state = fz_malloc_struct(ctx, fz_sgilog16);
fz_try(ctx)
{
state->run = 0;
@@ -325,6 +324,7 @@ fz_open_sgilog16(fz_context *ctx, fz_stream *chain, int w)
}
fz_catch(ctx)
{
+ fz_free(ctx, state->temp);
fz_free(ctx, state);
fz_rethrow(ctx);
}
@@ -478,22 +478,19 @@ close_sgilog24(fz_context *ctx, void *state_)
fz_stream *
fz_open_sgilog24(fz_context *ctx, fz_stream *chain, int w)
{
- fz_sgilog24 *state = NULL;
-
- fz_var(state);
+ fz_sgilog24 *state = fz_malloc_struct(ctx, fz_sgilog24);
fz_try(ctx)
{
- state = fz_malloc_struct(ctx, fz_sgilog24);
- state->chain = chain;
state->err = 0;
state->w = w;
state->temp = fz_malloc(ctx, w * 3);
+ state->chain = fz_keep_stream(ctx, chain);
}
fz_catch(ctx)
{
+ fz_free(ctx, state->temp);
fz_free(ctx, state);
- fz_drop_stream(ctx, chain);
fz_rethrow(ctx);
}
@@ -662,6 +659,7 @@ fz_open_sgilog32(fz_context *ctx, fz_stream *chain, int w)
}
fz_catch(ctx)
{
+ fz_free(ctx, state->temp);
fz_free(ctx, state);
fz_rethrow(ctx);
}