summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2022-08-31 08:54:20 +0100
committerChris Liddell <chris.liddell@artifex.com>2022-09-02 15:59:07 +0100
commitecb27b8b93ed1f9343c4b340da75da880716863c (patch)
tree19c4ec94f52c2468991b7fb4c2d178852477a33a
parent37a78c11f7d55d60cedfa168e4910e1bfb6a636c (diff)
downloadghostpdl-ecb27b8b93ed1f9343c4b340da75da880716863c.tar.gz
Coverity ID #380568
The cleanup code was misplaced, because the enumerator finalze resets the 'dev' member to NULL before we use it. Move the 'tif' cleanup earlier so we can use the dev member before it is set to NULL.
-rw-r--r--devices/vector/gdevxps.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/devices/vector/gdevxps.c b/devices/vector/gdevxps.c
index 7ca640e47..218b3c09c 100644
--- a/devices/vector/gdevxps.c
+++ b/devices/vector/gdevxps.c
@@ -2588,6 +2588,12 @@ xps_image_enum_finalize(const gs_memory_t *cmem, void *vptr)
xps_image_enum_t *xpie = (xps_image_enum_t *)vptr;
gx_device_xps *xdev = (gx_device_xps *)xpie->dev;
+ if (xpie->tif != NULL) {
+ tiff_client_release((gx_device_xps*)(xpie->dev), xpie->tif);
+ TIFFCleanup(xpie->tif);
+ xpie->tif = NULL;
+ }
+
xpie->dev = NULL;
if (xpie->pcs != NULL)
rc_decrement(xpie->pcs, "xps_image_end_image (pcs)");
@@ -2599,10 +2605,5 @@ xps_image_enum_finalize(const gs_memory_t *cmem, void *vptr)
/* ICC clean up */
if (xpie->icc_link != NULL)
gsicc_release_link(xpie->icc_link);
- if (xpie->tif != NULL) {
- tiff_client_release((gx_device_xps*)(xpie->dev), xpie->tif);
- TIFFCleanup(xpie->tif);
- xpie->tif = NULL;
- }
xdev->xps_pie = NULL;
}