diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2013-10-28 11:08:19 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2013-10-28 18:44:02 +0000 |
commit | 16fbdade9a29352ad936455eab65e77a9db6f768 (patch) | |
tree | 29a449eba4e3d9cec91ce2e47a7c43ac8f33e8bf | |
parent | 8f491ec1493bcb11583d450a264a1b80d5557217 (diff) | |
download | ghostpdl-16fbdade9a29352ad936455eab65e77a9db6f768.tar.gz |
Bug 694733 (part 1): fix incorrect offsets in chunk allocator
When I changed the chunk allocator to honor the alignment value for the
memory manager, I missed a couple of places where the calculation of the offset
to get from the allocated memory address to the address of the chunk node.
No cluster differences.
-rw-r--r-- | gs/base/gsmchunk.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gs/base/gsmchunk.c b/gs/base/gsmchunk.c index 850ba628b..0365c3474 100644 --- a/gs/base/gsmchunk.c +++ b/gs/base/gsmchunk.c @@ -576,7 +576,7 @@ static void * chunk_resize_object(gs_memory_t * mem, void *ptr, uint new_num_elements, client_name_t cname) { /* This isn't particularly efficient, but it is rarely used */ - chunk_obj_node_t *obj = ((chunk_obj_node_t *)ptr) - 1; + chunk_obj_node_t *obj = (chunk_obj_node_t *)(((byte *)ptr) - SIZEOF_ROUND_ALIGN(chunk_obj_node_t)); ulong new_size = (obj->type->ssize * new_num_elements); ulong old_size = obj->size; /* get the type from the old object */ @@ -839,7 +839,7 @@ chunk_consolidate_free(gs_memory_t *mem) static uint chunk_object_size(gs_memory_t * mem, const void *ptr) { - chunk_obj_node_t *obj = ((chunk_obj_node_t *)ptr) - 1; + chunk_obj_node_t *obj = (chunk_obj_node_t *)(((byte *)ptr) - SIZEOF_ROUND_ALIGN(chunk_obj_node_t)); return obj->size; } @@ -847,7 +847,7 @@ chunk_object_size(gs_memory_t * mem, const void *ptr) static gs_memory_type_ptr_t chunk_object_type(const gs_memory_t * mem, const void *ptr) { - chunk_obj_node_t *obj = ((chunk_obj_node_t *)ptr) - 1; + chunk_obj_node_t *obj = (chunk_obj_node_t *)(((byte *)ptr) - SIZEOF_ROUND_ALIGN(chunk_obj_node_t)); return obj->type; } |