diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2016-02-22 16:17:40 -0800 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2016-02-22 16:17:40 -0800 |
commit | 7fd83ca9b3c58bc3156611e2ad9349be9ef94718 (patch) | |
tree | f44f22b41e4a17ff844bec211d4342aef95f1b2e /source/pdf | |
parent | f99993f33a5af4dad808cb2f8d3668cbd0a192e9 (diff) | |
download | mupdf-7fd83ca9b3c58bc3156611e2ad9349be9ef94718.tar.xz |
Fix leaks in pdf-device.c
The Forms object should have been dropped once the reference was
created for it. Also needed to clean up the group and font
objects that the device maintains.
Diffstat (limited to 'source/pdf')
-rw-r--r-- | source/pdf/pdf-device.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c index 3bc7276b..2908b9fd 100644 --- a/source/pdf/pdf-device.c +++ b/source/pdf/pdf-device.c @@ -851,9 +851,12 @@ pdf_dev_new_form(fz_context *ctx, pdf_obj **form_ref, pdf_device *pdev, const fz pdf_dict_put_drop(ctx, form, PDF_NAME_BBox, pdf_new_rect(ctx, doc, bbox)); *form_ref = pdf_new_ref(ctx, doc, form); } - fz_catch(ctx) + fz_always(ctx) { pdf_drop_obj(ctx, form); + } + fz_catch(ctx) + { fz_rethrow(ctx); } @@ -1285,6 +1288,11 @@ pdf_dev_drop_imp(fz_context *ctx, fz_device *dev) pdf_drop_obj(ctx, pdev->images[i].ref); } + for (i = pdev->num_groups - 1; i >= 0; i--) + { + pdf_drop_obj(ctx, pdev->groups[i].ref); + } + if (pdev->contents) { pdf_update_stream(ctx, doc, pdev->contents, pdev->gstates[0].buf, 0); @@ -1298,6 +1306,8 @@ pdf_dev_drop_imp(fz_context *ctx, fz_device *dev) pdf_drop_obj(ctx, pdev->resources); + fz_free(ctx, pdev->groups); + fz_free(ctx, pdev->fonts); fz_free(ctx, pdev->images); fz_free(ctx, pdev->alphas); fz_free(ctx, pdev->gstates); |