diff options
author | Martin Willi <martin@strongswan.org> | 2005-12-01 16:14:00 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2005-12-01 16:14:00 +0000 |
commit | bae00c63f719c06c74d393c65bef0e5ebe25b24c (patch) | |
tree | ca3e7f408ae696eb161fdee9472d395fb5bd9785 /Source/charon/utils | |
parent | 0675d5e1a13ae288b573e855bb41af93f5a8c1f0 (diff) | |
download | strongswan-bae00c63f719c06c74d393c65bef0e5ebe25b24c.tar.bz2 strongswan-bae00c63f719c06c74d393c65bef0e5ebe25b24c.tar.xz |
- fixed some bugx when !LEAK_DETECTIVE
Diffstat (limited to 'Source/charon/utils')
-rw-r--r-- | Source/charon/utils/allocator.c | 7 | ||||
-rw-r--r-- | Source/charon/utils/allocator.h | 2 |
2 files changed, 4 insertions, 5 deletions
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. |