summaryrefslogtreecommitdiff
path: root/fitz/filt_basic.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-12-15 21:25:04 +0000
committerRobin Watts <robin.watts@artifex.com>2011-12-15 21:25:04 +0000
commit7992dd366101180c050f37167d91518c52cf025c (patch)
treef85ad161cba95a6355c52c1c97b57b5380cef6d1 /fitz/filt_basic.c
parentddbce91f5b70281f84a742845e9228ccfb607756 (diff)
downloadmupdf-7992dd366101180c050f37167d91518c52cf025c.tar.xz
More Memsqueezing fixes.
Diffstat (limited to 'fitz/filt_basic.c')
-rw-r--r--fitz/filt_basic.c15
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 */