summaryrefslogtreecommitdiff
path: root/source/xps/xps-outline.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/xps/xps-outline.c')
-rw-r--r--source/xps/xps-outline.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/source/xps/xps-outline.c b/source/xps/xps-outline.c
index 61736992..bf43f251 100644
--- a/source/xps/xps-outline.c
+++ b/source/xps/xps-outline.c
@@ -83,37 +83,26 @@ static fz_outline *
xps_load_document_structure(fz_context *ctx, xps_document *doc, xps_fixdoc *fixdoc)
{
xps_part *part;
- fz_xml *root = NULL;
+ fz_xml_doc *xml = NULL;
fz_outline *outline = NULL;
+ fz_var(xml);
+
part = xps_read_part(ctx, doc, fixdoc->outline);
fz_try(ctx)
{
- root = fz_parse_xml(ctx, part->data, 0);
+ xml = fz_parse_xml(ctx, part->data, 0);
+ outline = xps_parse_document_structure(ctx, doc, fz_xml_root(xml));
}
fz_always(ctx)
{
+ fz_drop_xml(ctx, xml);
xps_drop_part(ctx, doc, part);
}
fz_catch(ctx)
{
fz_rethrow(ctx);
}
- if (!root)
- return NULL;
-
- fz_try(ctx)
- {
- outline = xps_parse_document_structure(ctx, doc, root);
- }
- fz_always(ctx)
- {
- fz_drop_xml(ctx, root);
- }
- fz_catch(ctx)
- {
- fz_rethrow(ctx);
- }
return outline;
}