summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2018-10-02 13:20:45 +0800
committerTor Andersson <tor.andersson@artifex.com>2018-10-23 18:46:01 +0200
commit9dffe5b5b9dbb6ecd003c6daa539bdb0705e48f0 (patch)
treee86ee9bd53f11c43a6650f94c96da226aff535f0 /source
parent127f294690a06b757de8ac760a69847b88356b3b (diff)
downloadmupdf-9dffe5b5b9dbb6ecd003c6daa539bdb0705e48f0.tar.xz
Drop document upon exception opening directory.
Or problem allocating a new html font set.
Diffstat (limited to 'source')
-rw-r--r--source/html/html-doc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/html/html-doc.c b/source/html/html-doc.c
index 21c9c653..672966ea 100644
--- a/source/html/html-doc.c
+++ b/source/html/html-doc.c
@@ -155,16 +155,21 @@ htdoc_open_document_with_stream(fz_context *ctx, fz_stream *file)
doc->super.lookup_metadata = htdoc_lookup_metadata;
doc->super.is_reflowable = 1;
- doc->zip = fz_open_directory(ctx, ".");
- doc->set = fz_new_html_font_set(ctx);
-
- buf = fz_read_all(ctx, file, 0);
fz_try(ctx)
+ {
+ doc->zip = fz_open_directory(ctx, ".");
+ doc->set = fz_new_html_font_set(ctx);
+
+ buf = fz_read_all(ctx, file, 0);
doc->html = fz_parse_html(ctx, doc->set, doc->zip, ".", buf, fz_user_css(ctx));
+ }
fz_always(ctx)
fz_drop_buffer(ctx, buf);
fz_catch(ctx)
+ {
+ fz_drop_document(ctx, &doc->super);
fz_rethrow(ctx);
+ }
return &doc->super;
}