diff options
author | Shailesh Mistry <shailesh.mistry@hotmail.co.uk> | 2019-09-27 11:16:23 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2019-10-23 16:35:14 +0100 |
commit | a44d0ce727f2095fbbedb8bf6b1e062fca3c8f01 (patch) | |
tree | a50460899e85e7dfe5d9a63bac589457203345cd /base | |
parent | 4637eeae2415b593d84bb60dbac5369eb2ecc54b (diff) | |
download | ghostpdl-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')
-rw-r--r-- | base/gxacpath.c | 4 | ||||
-rw-r--r-- | base/gxcpath.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/base/gxacpath.c b/base/gxacpath.c index 6487c3005..ebed0eb69 100644 --- a/base/gxacpath.c +++ b/base/gxacpath.c @@ -228,8 +228,8 @@ gx_cpath_accum_end(gx_device_cpath_accum * padev, gx_clip_path * pcpath) apath.path_valid = false; apath.id = gs_next_ids(padev->list_memory, 1); /* path changed => change id */ apath.cached = NULL; - gx_cpath_assign_free(pcpath, &apath); - return 0; + code = gx_cpath_assign_free(pcpath, &apath); + return code; } /* Discard an accumulator in case of error. */ 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; } |