From bae00c63f719c06c74d393c65bef0e5ebe25b24c Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Thu, 1 Dec 2005 16:14:00 +0000 Subject: - fixed some bugx when !LEAK_DETECTIVE --- Source/charon/utils/allocator.c | 7 +++---- Source/charon/utils/allocator.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'Source') diff --git a/Source/charon/utils/allocator.c b/Source/charon/utils/allocator.c index 8c314a88a..b22dec039 100644 --- a/Source/charon/utils/allocator.c +++ b/Source/charon/utils/allocator.c @@ -342,9 +342,8 @@ chunk_t allocator_alloc_as_chunk(size_t bytes) { chunk_t new_chunk; new_chunk.ptr = malloc(bytes); - if ((new_chunk.ptr == NULL) + if (new_chunk.ptr == NULL) { - /* TODO log this case */ exit(-1); } new_chunk.len = bytes; @@ -380,14 +379,14 @@ void * allocator_clone_bytes(void * pointer, size_t size) /** * Described in header */ -static chunk_t clone_chunk(chunk_t chunk) +chunk_t allocator_clone_chunk(chunk_t chunk) { chunk_t clone = CHUNK_INITIALIZER; if (chunk.ptr && chunk.len > 0) { clone.ptr = malloc(chunk.len); - if (clone.ptr == NULL) {exit(-1)}; + if (clone.ptr == NULL) {exit(-1);} clone.len = chunk.len; memcpy(clone.ptr, chunk.ptr, chunk.len); } diff --git a/Source/charon/utils/allocator.h b/Source/charon/utils/allocator.h index a86311789..7ea0fb60d 100644 --- a/Source/charon/utils/allocator.h +++ b/Source/charon/utils/allocator.h @@ -300,7 +300,7 @@ * * @ingroup utils */ - chunk_t allocator_clone_bytes(chunk_t chunk); + chunk_t allocator_clone_chunk(chunk_t chunk); /** * Frees memory used by chunk. -- cgit v1.2.3