From 06cc3853ecb77ce4bc18ed6b6f30e031876e442a Mon Sep 17 00:00:00 2001 From: nadiramra Date: Mon, 31 May 2010 01:30:46 +0000 Subject: AXIS2C-1461 axutil_allocator_init(): unsafe memset() call git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@949639 13f79535-47bb-0310-9956-ffa450edef68 --- util/src/allocator.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/util/src/allocator.c b/util/src/allocator.c index 1b31048..40261a9 100644 --- a/util/src/allocator.c +++ b/util/src/allocator.c @@ -37,24 +37,20 @@ AXIS2_EXTERN axutil_allocator_t *AXIS2_CALL axutil_allocator_init( axutil_allocator_t * allocator) { - if(allocator) - return allocator; - - else + if(!allocator) { allocator = (axutil_allocator_t *)malloc(sizeof(axutil_allocator_t)); - memset(allocator, 0, sizeof(axutil_allocator_t)); - if(allocator) + if (allocator) { + memset(allocator, 0, sizeof(axutil_allocator_t)); allocator->malloc_fn = axutil_allocator_malloc_impl; allocator->realloc = axutil_allocator_realloc_impl; allocator->free_fn = axutil_allocator_free_impl; allocator->global_pool_ref = 0; - - return allocator; } } - return NULL; + + return allocator; } AXIS2_EXTERN axutil_allocator_t *AXIS2_CALL -- cgit v1.1-32-gdbae