diff options
author | Shailesh Mistry <shailesh.mistry@hotmail.co.uk> | 2018-01-20 14:34:13 +0000 |
---|---|---|
committer | Shailesh Mistry <shailesh.mistry@hotmail.co.uk> | 2018-01-20 14:34:13 +0000 |
commit | b09da43f803fda306d3eb8eca99d825f70156db7 (patch) | |
tree | 195ce5e6aac38f154ea980a5d67cb3cee631a78f /base/gp_unifs.c | |
parent | 76c335c7672e3841055d6c6effc2ae61715c8b6a (diff) | |
download | ghostpdl-b09da43f803fda306d3eb8eca99d825f70156db7.tar.gz |
Bug 697545 : Fix memory leak in gp_enumerate_files_init.
Fix memory leak for allocation event numbers 199 and 200.
Error created using :-
MEMENTO_FAILAT=201 ./membin/gpcl6 -sDEVICE=ppmraw -o /dev/null ./pcl/examples/owl.pcl
Diffstat (limited to 'base/gp_unifs.c')
-rw-r--r-- | base/gp_unifs.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/base/gp_unifs.c b/base/gp_unifs.c index e23b1dc5d..51ce4e45a 100644 --- a/base/gp_unifs.c +++ b/base/gp_unifs.c @@ -388,14 +388,14 @@ gp_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem) (char *)gs_alloc_bytes(mem, patlen + 1, "gp_enumerate_files(pattern)"); if (pfen->pattern == 0) - return 0; + goto fail1; memcpy(pfen->pattern, pat, patlen); pfen->pattern[patlen] = 0; work = (char *)gs_alloc_bytes(mem, FILENAME_MAX + 1, "gp_enumerate_files(work)"); if (work == 0) - return 0; + goto fail2; pfen->work = work; p = work; @@ -429,6 +429,12 @@ gp_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem) } return pfen; + +fail2: + gs_free_object(mem, pfen->pattern, "gp_enumerate_files(pattern)"); +fail1: + gs_free_object(mem, pfen, "gp_enumerate_files"); + return NULL; #endif } |