diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2023-02-22 12:16:47 +0000 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2023-02-22 14:40:24 +0000 |
commit | f36bb2f9f5b518d1ba23370f6e17c27a62489142 (patch) | |
tree | 378c4ece0f4305ea7d2bba14081db723276e5d27 /gpdl | |
parent | c1d0170b2fad8386a9e41da27e6c7f422ed4fd3c (diff) | |
download | ghostpdl-f36bb2f9f5b518d1ba23370f6e17c27a62489142.tar.gz |
Fix memory leak seen in apitest using gpdl.
A C parameter list leaks when used in gpdl. Presumably this is
not seen in gs operation because of garbage collection.
We already have a function to allocate a C parameter list
(gs_c_param_list_alloc). We've always been releasing this
(gs_c_param_list_release), but that just releases the contents
not the list itself. Add a new function (gs_c_param_list_free)
that both releases and frees, and call this as appropriate.
Diffstat (limited to 'gpdl')
-rw-r--r-- | gpdl/psitop.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gpdl/psitop.c b/gpdl/psitop.c index 94dfa2a8b..ffd729d58 100644 --- a/gpdl/psitop.c +++ b/gpdl/psitop.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2022 Artifex Software, Inc. +/* Copyright (C) 2001-2023 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -441,16 +441,17 @@ ps_impl_init_job(pl_interp_implementation_t *impl, gs_param_list_set_persistent_keys((gs_param_list*)params, false); code2 = param_write_int((gs_param_list*)params, "PageSpotColors", &(page_spot_colors)); - if (code2 < 0) + if (code2 < 0) { + gs_c_param_list_free(psi->memory, params, "ps_impl_init_job"); return code2; + } gs_c_param_list_read(params); code2 = psapi_set_device_param(psi->psapi_instance, (gs_param_list*)params); + gs_c_param_list_free(psi->memory, params, "ps_impl_init_job"); if (code2 < 0) return code2; - - gs_c_param_list_release(params); } return code; } |