[gs-commits] mupdf 1.16.1.95 When PDF resource hash throws exception,
[email protected] (Sebastian Rasmussen) Wed, 16 Oct 2019 18:12:28 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 35adcbcf03fae08e8b84e95c45212e8ccc8f2d92 Author: Sebastian Rasmussen <[email protected]> Date: Wed Oct 16 19:05:13 2019 +0200 When PDF resource hash throws exception, avoid leaking inserted reference. Previously we kept the local reference in pdf_preload_image_resources() and took another reference to give to the hash. Upon exception this later reference would leak. By instead giving away our local reference the leak can no longer happen. diff --git a/source/pdf/pdf-resources.c b/source/pdf/pdf-resources.c index 82991f6..f0b6819 100644 --- a/source/pdf/pdf-resources.c +++ b/source/pdf/pdf-resources.c @@ -51,7 +51,10 @@ pdf_preload_image_resources(fz_context *ctx, pdf_document *doc) /* Don't allow overwrites. */ if (!fz_hash_find(ctx, doc->resources.images, digest)) - fz_hash_insert(ctx, doc->resources.images, digest, pdf_keep_obj(ctx, obj)); + { + fz_hash_insert(ctx, doc->resources.images, digest, obj); + obj = NULL; + } } pdf_drop_obj(ctx, obj); obj = NULL; http://git.ghostscript.com/?p=mupdf.git;a=commit;h=35adcbcf03fae08e8b84e95c45212e8ccc8f2d92 -- MuPDF library Artifex Software, Inc.