From 9ccdd63f008d865b87e9f55b24a0276670844786 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 30 Mar 2016 16:39:36 +0100 Subject: Use fz_new_document for pdf and html docs. In particular for html docs we were getting the refcount wrong, causing us to leak on closedown. --- source/pdf/pdf-xref.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/pdf') diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index f8711d3c..6eca8a74 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -2325,9 +2325,8 @@ pdf_page_presentation(fz_context *ctx, pdf_page *page, float *duration) static pdf_document * pdf_new_document(fz_context *ctx, fz_stream *file) { - pdf_document *doc = fz_malloc_struct(ctx, pdf_document); + pdf_document *doc = fz_new_document(ctx, sizeof *doc); - doc->super.refs = 1; doc->super.close = (fz_document_close_fn *)pdf_close_document; doc->super.needs_password = (fz_document_needs_password_fn *)pdf_needs_password; doc->super.authenticate_password = (fz_document_authenticate_password_fn *)pdf_authenticate_password; -- cgit v1.2.3