summaryrefslogtreecommitdiff
path: root/base/gxcpath.c
diff options
context:
space:
mode:
authorShailesh Mistry <shailesh.mistry@hotmail.co.uk>2019-09-27 11:16:23 +0100
committerRobin Watts <Robin.Watts@artifex.com>2019-10-23 16:35:14 +0100
commita44d0ce727f2095fbbedb8bf6b1e062fca3c8f01 (patch)
treea50460899e85e7dfe5d9a63bac589457203345cd /base/gxcpath.c
parent4637eeae2415b593d84bb60dbac5369eb2ecc54b (diff)
downloadghostpdl-a44d0ce727f2095fbbedb8bf6b1e062fca3c8f01.tar.gz
Bug 697545 : Prevent memory leaks in gx_cpath_assign_preserve.
Update functionality to propagate error codes correctly and release path segments. Error created using :- MEMENTO_FAILAT=15840 ./membin/gpcl6 -sDEVICE=pbmraw -o /dev/null ./tests_private/pcl/pcl5cfts/fts.1552
Diffstat (limited to 'base/gxcpath.c')
-rw-r--r--base/gxcpath.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/base/gxcpath.c b/base/gxcpath.c
index ecdfe0959..4c3d34781 100644
--- a/base/gxcpath.c
+++ b/base/gxcpath.c
@@ -325,8 +325,10 @@ gx_cpath_assign_preserve(gx_clip_path * pcpto, gx_clip_path * pcpfrom)
int code = cpath_alloc_list(&tolist, tolist->rc.memory,
"gx_cpath_assign");
- if (code < 0)
+ if (code < 0) {
+ rc_decrement(pcpto->path.segments, "gx_path_assign");
return code;
+ }
rc_decrement(pcpto->rect_list, "gx_cpath_assign");
} else {
/* Use pcpto's list object. */
@@ -354,7 +356,7 @@ gx_cpath_assign_free(gx_clip_path * pcpto, gx_clip_path * pcpfrom)
int code = gx_cpath_assign_preserve(pcpto, pcpfrom);
if (code < 0)
- return 0;
+ return code;
gx_cpath_free(pcpfrom, "gx_cpath_assign_free");
return 0;
}