summaryrefslogtreecommitdiff
path: root/pl/plalloc.c
diff options
context:
space:
mode:
authorHenry Stiles <henry.stiles@artifex.com>2007-01-18 20:22:24 +0000
committerHenry Stiles <henry.stiles@artifex.com>2007-01-18 20:22:24 +0000
commitdb2dafc76470e3ee24e6030f37578cb9a7c3e9cb (patch)
tree7d35c7cee9488f4954b3c574f6f88a7b695e24b4 /pl/plalloc.c
parent6c4ca7307e923238aada9c91180749fcab69e0f8 (diff)
implement finalization in the small allocator. This fixes some
recently noted memory leaks in the clients. Note, a similar change should be made in the gslite allocator. This has been tested on 32 and 64 bit machine but the code is not conventional. The object header size and type should be maintained in a padded c struct as it is in ghostscript. git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@2734 06663e23-700e-0410-b217-a244a6096597
Diffstat (limited to 'pl/plalloc.c')
-rw-r--r--pl/plalloc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pl/plalloc.c b/pl/plalloc.c
index 287cf6cfc..6abf89bf7 100644
--- a/pl/plalloc.c
+++ b/pl/plalloc.c
@@ -327,7 +327,10 @@ pl_free_object(gs_memory_t * mem, void *ptr, client_name_t cname)
if ( ptr != NULL ) {
uint header_size = round_up_to_align(1) + round_up_to_align(1);
byte *bptr = (byte *)ptr - header_size;
-
+ gs_memory_type_ptr_t ptype = get_type((byte *)ptr);
+ void (*finalize)(void *ptr) = ptype->finalize;
+ if ( finalize != NULL )
+ finalize(ptr);
#ifdef DEBUG
if ( gs_debug_c('@') )
memset(bptr, 0xee, header_size + get_size(ptr));