diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2020-02-13 11:11:40 -0800 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2020-02-14 09:26:58 +0000 |
commit | b58e9010ce17bce450e4c042b93bafc460b9d94a (patch) | |
tree | 6341b2289620082f268d4e612bac0b93dc3c16d4 /gpdl | |
parent | 5fc8e7c0b656d4e2be8f5e316121f06039c35273 (diff) | |
download | ghostpdl-b58e9010ce17bce450e4c042b93bafc460b9d94a.tar.gz |
Alternative fix for leaks after error in gs_main_init_with_args01()
When memory squeezing gpdl, Julian found leaks in the gpdl
startup of the postscript interpreter when allocations failed
in gs_main_init_with_args01().
Here, we fix the problem by making the psitop.c layer within gpdl
call the appropriate shutdown code when we catch the error. This
moves gpdl to being consistent with other users of the gs_main
layer.
Memento memory squeezing around the point of failure (event 2035)
now shows this to be OK.
MEMENTO_SQUEEZEAT=2034 ./membin/gpdl -sDEVICE=bit -o /dev/null examples/tiger.eps
Diffstat (limited to 'gpdl')
-rw-r--r-- | gpdl/psitop.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gpdl/psitop.c b/gpdl/psitop.c index 937bf9932..9ff50fd75 100644 --- a/gpdl/psitop.c +++ b/gpdl/psitop.c @@ -359,6 +359,7 @@ ps_impl_allocate_interp_instance(pl_interp_implementation_t *impl, gs_memory_t * code = psapi_init_with_args01(psi->psapi_instance, nargs, (char **)gsargs); if (code < 0) { + (void)psapi_exit(psi->psapi_instance); psapi_delete_instance(psi->psapi_instance); gs_free_object(mem, psi, "ps_impl_allocate_interp_instance"); } |