summaryrefslogtreecommitdiff
path: root/source/html
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-06-12 08:32:37 +0800
committerSebastian Rasmussen <sebras@gmail.com>2017-06-28 23:22:45 +0800
commit46aeda6ae19f871b109ef0b724f86a79b85b0044 (patch)
treeabe9c03c3933fdca7db1bc9cfd2c332fffed01a0 /source/html
parent6fc5f6e800e220d0236aff4e505af439a0d3cb88 (diff)
downloadmupdf-46aeda6ae19f871b109ef0b724f86a79b85b0044.tar.xz
Always drop xml in case of error in HTML processing.
Diffstat (limited to 'source/html')
-rw-r--r--source/html/html-layout.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/html/html-layout.c b/source/html/html-layout.c
index 1ad37f8f..5b514760 100644
--- a/source/html/html-layout.c
+++ b/source/html/html-layout.c
@@ -2664,14 +2664,23 @@ fz_parse_html(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const cha
g.pool = NULL;
g.set = set;
g.zip = zip;
+ g.images = NULL;
g.base_uri = base_uri;
+ g.css = NULL;
g.at_bol = 0;
g.emit_white = 0;
g.last_brk_cls = UCDN_LINEBREAK_CLASS_OP;
xml = fz_parse_xml(ctx, buf, 1);
- g.css = fz_new_css(ctx);
+ fz_try(ctx)
+ g.css = fz_new_css(ctx);
+ fz_catch(ctx)
+ {
+ fz_drop_xml(ctx, xml);
+ fz_rethrow(ctx);
+ }
+
fz_try(ctx)
{
if (fz_xml_find(xml, "FictionBook"))
@@ -2697,18 +2706,16 @@ fz_parse_html(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const cha
fz_add_css_font_faces(ctx, g.set, g.zip, g.base_uri, g.css); /* load @font-face fonts into font set */
}
fz_catch(ctx)
- {
fz_warn(ctx, "ignoring styles due to errors: %s", fz_caught_message(ctx));
- }
#ifndef NDEBUG
if (fz_atoi(getenv("FZ_DEBUG_CSS")))
fz_debug_css(ctx, g.css);
#endif
- g.pool = fz_new_pool(ctx);
fz_try(ctx)
{
+ g.pool = fz_new_pool(ctx);
html = fz_pool_alloc(ctx, g.pool, sizeof *html);
html->pool = g.pool;
html->root = new_box(ctx, g.pool, DEFAULT_DIR);
@@ -2725,9 +2732,9 @@ fz_parse_html(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const cha
}
fz_always(ctx)
{
+ fz_drop_tree(ctx, g.images, (void(*)(fz_context*,void*))fz_drop_image);
fz_drop_css(ctx, g.css);
fz_drop_xml(ctx, xml);
- fz_drop_tree(ctx, g.images, (void(*)(fz_context*,void*))fz_drop_image);
}
fz_catch(ctx)
{