diff options
author | Robin Watts <robin.watts@artifex.com> | 2011-12-15 21:25:04 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2011-12-15 21:25:04 +0000 |
commit | 7992dd366101180c050f37167d91518c52cf025c (patch) | |
tree | f85ad161cba95a6355c52c1c97b57b5380cef6d1 /fitz/filt_basic.c | |
parent | ddbce91f5b70281f84a742845e9228ccfb607756 (diff) | |
download | mupdf-7992dd366101180c050f37167d91518c52cf025c.tar.xz |
More Memsqueezing fixes.
Diffstat (limited to 'fitz/filt_basic.c')
-rw-r--r-- | fitz/filt_basic.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fitz/filt_basic.c b/fitz/filt_basic.c index 3d211645..7e5f2f21 100644 --- a/fitz/filt_basic.c +++ b/fitz/filt_basic.c @@ -39,13 +39,24 @@ fz_stream * fz_open_null(fz_stream *chain, int len) { struct null_filter *state; + fz_stream *stream; + fz_context *ctx = chain->ctx; assert(chain); - state = fz_malloc(chain->ctx, sizeof(struct null_filter)); + state = fz_malloc(ctx, sizeof(struct null_filter)); state->chain = chain; state->remain = len; - return fz_new_stream(chain->ctx, state, read_null, close_null); + fz_try(ctx) + { + stream = fz_new_stream(ctx, state, read_null, close_null); + } + fz_catch(ctx) + { + fz_free(ctx, state); + fz_rethrow(ctx); + } + return stream; } /* ASCII Hex Decode */ |