summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-09-26 02:31:32 +0800
committerSebastian Rasmussen <sebras@gmail.com>2016-09-26 18:35:33 +0800
commitecc5c28eb0eb9801bf7c434c1483d6e3ab997075 (patch)
treeb2a29f01589cf12d247101f443a48355a1e44461 /source/pdf
parentdf6fca4d8306c06e262ae8ed88c90d7b0400dac5 (diff)
downloadmupdf-ecc5c28eb0eb9801bf7c434c1483d6e3ab997075.tar.xz
Fix memory leak when opening html/loading raw stream.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-stream.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/pdf/pdf-stream.c b/source/pdf/pdf-stream.c
index 9ff136b2..39f85b0b 100644
--- a/source/pdf/pdf-stream.c
+++ b/source/pdf/pdf-stream.c
@@ -458,9 +458,13 @@ pdf_load_raw_stream_number(fz_context *ctx, pdf_document *doc, int num)
stm = pdf_open_raw_stream_number(ctx, doc, num);
- buf = fz_read_all(ctx, stm, len);
+ fz_try(ctx)
+ buf = fz_read_all(ctx, stm, len);
+ fz_always(ctx)
+ fz_drop_stream(ctx, stm);
+ fz_catch(ctx)
+ fz_rethrow(ctx);
- fz_drop_stream(ctx, stm);
return buf;
}