summaryrefslogtreecommitdiff
path: root/base/gximage1.c
diff options
context:
space:
mode:
authorRay Johnston <ray.johnston@artifex.com>2017-02-07 20:28:28 -0800
committerRay Johnston <ray.johnston@artifex.com>2017-02-08 06:25:16 -0800
commitcffb5712bc10c2c2f46adf311fc74aaae74cb784 (patch)
treec6a28e5542295d07554059f3a72c5ad275816c0c /base/gximage1.c
parenta1b951c274a1d48340cfbaddb1308c92836dbc61 (diff)
downloadghostpdl-cffb5712bc10c2c2f46adf311fc74aaae74cb784.tar.gz
Commit a9a58bb95 was incorrect, clearing some values that it shouldn't
The penum->rect values were cleared, and this didn't cover all uses of gx_image_enum_alloc. Also, return *ppenum NULL if alloc fails in case the caller doesn't check the return code. Also, if we fail the enum_begin, free the enum and set *pinfo to NULL.
Diffstat (limited to 'base/gximage1.c')
-rw-r--r--base/gximage1.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/base/gximage1.c b/base/gximage1.c
index a1ee9e2c9..a773944c8 100644
--- a/base/gximage1.c
+++ b/base/gximage1.c
@@ -85,7 +85,6 @@ gx_begin_image1(gx_device * dev,
if (code < 0)
return code;
- memset(penum, 0, sizeof(gx_image_enum)); /* in case of failure, no dangling pointers */
penum->alpha = pim->Alpha;
penum->use_mask_color = false;
penum->image_parent_type = pim->image_parent_type;
@@ -96,6 +95,10 @@ gx_begin_image1(gx_device * dev,
penum);
if (code >= 0)
*pinfo = (gx_image_enum_common_t *)penum;
+ else {
+ gs_free_object(mem, penum, "gx_begin_image1");
+ *pinfo = NULL;
+ }
return code;
}