summaryrefslogtreecommitdiff
path: root/source/fitz/stream-open.c
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2017-03-09 17:09:51 +0000
committerRobin Watts <Robin.Watts@artifex.com>2017-03-10 18:03:59 -0600
commitea00b61c7ccd14422bef33282e18fa8b4660fe74 (patch)
tree3c134043132814f0d20867be11c8d280450e5737 /source/fitz/stream-open.c
parentb346bd28080a86acec3029aeda39e10213d431a5 (diff)
downloadmupdf-ea00b61c7ccd14422bef33282e18fa8b4660fe74.tar.xz
Fix potential double frees in error cases.
fz_new_stream cleans up the passed in state if the allocation fails, so don't free it in the caller too.
Diffstat (limited to 'source/fitz/stream-open.c')
-rw-r--r--source/fitz/stream-open.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/source/fitz/stream-open.c b/source/fitz/stream-open.c
index f999014b..d1d35cbb 100644
--- a/source/fitz/stream-open.c
+++ b/source/fitz/stream-open.c
@@ -112,15 +112,7 @@ fz_open_file_ptr(fz_context *ctx, FILE *file)
fz_file_stream *state = fz_malloc_struct(ctx, fz_file_stream);
state->file = file;
- fz_try(ctx)
- {
- stm = fz_new_stream(ctx, state, next_file, close_file);
- }
- fz_catch(ctx)
- {
- fz_free(ctx, state);
- fz_rethrow(ctx);
- }
+ stm = fz_new_stream(ctx, state, next_file, close_file);
stm->seek = seek_file;
return stm;