From d5fc0f731d2eb6dcc11e680b2e77890b7ba01725 Mon Sep 17 00:00:00 2001 From: Jan Hutter Date: Wed, 16 Nov 2005 14:44:25 +0000 Subject: - tried to fix memory errors --- Source/charon/utils/allocator.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Source/charon/utils/allocator.c') diff --git a/Source/charon/utils/allocator.c b/Source/charon/utils/allocator.c index 290b1de3b..4c65bbbf0 100644 --- a/Source/charon/utils/allocator.c +++ b/Source/charon/utils/allocator.c @@ -112,18 +112,18 @@ struct private_allocator_s */ static void *allocate_special(private_allocator_t *this,size_t bytes, char * file,int line, bool use_mutex) { - memory_hdr_t *allocated_memory = malloc(sizeof(memory_hdr_t) + bytes); - - if (allocated_memory == NULL) + memory_hdr_t *allocated_memory = malloc(sizeof(memory_hdr_t) + bytes);; + + if (allocated_memory == NULL) { return allocated_memory; } - + if (use_mutex) { pthread_mutex_lock( &(this->mutex)); } - + allocated_memory->info.line = line; allocated_memory->info.filename = file; allocated_memory->info.size_of_memory = bytes; @@ -326,6 +326,11 @@ chunk_t allocator_alloc_as_chunk(size_t bytes) } +void * allocator_realloc(void * old, size_t newsize) +{ + return realloc(old,newsize); +} + void * allocator_clone_bytes(void * pointer, size_t size) { void *data; -- cgit v1.2.3