[gs-cvs] rev 7103 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Wed Oct 11 13:06:11 PDT 2006
Author: leonardo
Date: 2006-10-11 13:06:11 -0700 (Wed, 11 Oct 2006)
New Revision: 7103
Modified:
trunk/gs/src/gsmalloc.c
Log:
Fix (memory manager) : gs_heap_free_object could break itself.
DETAILS :
See comment in code.
Debugged with ghostpcl 18-21.BIN .
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gsmalloc.c
===================================================================
--- trunk/gs/src/gsmalloc.c 2006-10-11 18:50:08 UTC (rev 7102)
+++ trunk/gs/src/gsmalloc.c 2006-10-11 20:06:11 UTC (rev 7103)
@@ -287,7 +287,7 @@
gs_heap_free_object(gs_memory_t * mem, void *ptr, client_name_t cname)
{
gs_malloc_memory_t *mmem = (gs_malloc_memory_t *) mem;
- gs_malloc_block_t *bp = mmem->allocated;
+ gs_malloc_block_t *bp;
gs_memory_type_ptr_t pstype;
struct_proc_finalize((*finalize));
@@ -304,6 +304,9 @@
(ulong) ptr, client_name_string(cname));
(*finalize) (ptr);
}
+ bp = mmem->allocated; /* If 'finalize' releases a memory,
+ this function could be called recursively and
+ change mmem->allocated. */
if (ptr == bp + 1) {
mmem->allocated = bp->next;
mmem->used -= bp->size + sizeof(gs_malloc_block_t);
More information about the gs-cvs
mailing list