summaryrefslogtreecommitdiff
path: root/fitz/filt_basic.c
diff options
context:
space:
mode:
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 */