diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-12-17 00:49:23 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2011-12-17 00:49:23 +0000 |
commit | 3eae1449777c4ecccc73a156c7dfff42f927ccc4 (patch) | |
tree | b0cd1bc08b3af218dd06c501402782db91ad0523 /fitz/filt_faxd.c | |
parent | c53b6af33c996a7ae6815ac15254297d43f43a9c (diff) | |
download | mupdf-3eae1449777c4ecccc73a156c7dfff42f927ccc4.tar.xz |
More memsqueezing fixes; stream creation.
Diffstat (limited to 'fitz/filt_faxd.c')
-rw-r--r-- | fitz/filt_faxd.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/fitz/filt_faxd.c b/fitz/filt_faxd.c index 309844bf..0a2426d0 100644 --- a/fitz/filt_faxd.c +++ b/fitz/filt_faxd.c @@ -662,28 +662,28 @@ close_faxd(fz_context *ctx, void *state_) fz_stream * fz_open_faxd(fz_stream *chain, fz_obj *params) { - fz_faxd *fax; + fz_faxd *fax = NULL; fz_obj *obj; - fz_context *ctx; - - assert(chain); - ctx = chain->ctx; - fax = fz_malloc_struct(ctx, fz_faxd); - fax->chain = chain; + fz_context *ctx = chain->ctx; - fax->ref = NULL; - fax->dst = NULL; - - fax->k = 0; - fax->end_of_line = 0; - fax->encoded_byte_align = 0; - fax->columns = 1728; - fax->rows = 0; - fax->end_of_block = 1; - fax->black_is_1 = 0; + fz_var(fax); fz_try(ctx) { + fax = fz_malloc_struct(ctx, fz_faxd); + fax->chain = chain; + + fax->ref = NULL; + fax->dst = NULL; + + fax->k = 0; + fax->end_of_line = 0; + fax->encoded_byte_align = 0; + fax->columns = 1728; + fax->rows = 0; + fax->end_of_block = 1; + fax->black_is_1 = 0; + obj = fz_dict_gets(params, "K"); if (obj) fax->k = fz_to_int(obj); @@ -726,9 +726,13 @@ fz_open_faxd(fz_stream *chain, fz_obj *params) } fz_catch(ctx) { - fz_free(ctx, fax->dst); - fz_free(ctx, fax->ref); + if (fax) + { + fz_free(ctx, fax->dst); + fz_free(ctx, fax->ref); + } fz_free(ctx, fax); + fz_close(chain); fz_rethrow(ctx); } |