summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-10-12 13:22:15 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-10-12 15:18:07 +0200
commit595e923e6ef87d86c1455665a2ffbececf2f44ed (patch)
treeb5f4223787d9df029f39bb047e95c0f1fafdf1c1 /source
parentb95c8cfe4e14fd48c958d09508579e9193f28760 (diff)
downloadmupdf-595e923e6ef87d86c1455665a2ffbececf2f44ed.tar.xz
Fix reference counting error in pdf_add_page.
Diffstat (limited to 'source')
-rw-r--r--source/pdf/pdf-page.c2
-rw-r--r--source/tools/pdfportfolio.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/source/pdf/pdf-page.c b/source/pdf/pdf-page.c
index f47593d0..de12fb71 100644
--- a/source/pdf/pdf-page.c
+++ b/source/pdf/pdf-page.c
@@ -1051,7 +1051,7 @@ pdf_add_page(fz_context *ctx, pdf_document *doc, const fz_rect *mediabox, int ro
pdf_dict_put_drop(ctx, page_obj, PDF_NAME_Rotate, pdf_new_int(ctx, doc, rotate));
if (pdf_is_indirect(ctx, resources))
- pdf_dict_put_drop(ctx, page_obj, PDF_NAME_Resources, resources);
+ pdf_dict_put(ctx, page_obj, PDF_NAME_Resources, resources);
else if (pdf_is_dict(ctx, resources))
pdf_dict_put_drop(ctx, page_obj, PDF_NAME_Resources, pdf_add_object(ctx, doc, resources));
else
diff --git a/source/tools/pdfportfolio.c b/source/tools/pdfportfolio.c
index 9f08cff1..056bb678 100644
--- a/source/tools/pdfportfolio.c
+++ b/source/tools/pdfportfolio.c
@@ -265,6 +265,7 @@ int pdfportfolio_main(int argc, char **argv)
page_obj = pdf_add_page(ctx, doc, &mediabox, 0, resources, contents);
pdf_insert_page(ctx, doc, -1, page_obj);
pdf_drop_obj(ctx, page_obj);
+ pdf_drop_obj(ctx, resources);
fz_drop_buffer(ctx, contents);
}
}