summaryrefslogtreecommitdiffstats
path: root/util/src
diff options
context:
space:
mode:
authorGravatar nadiramra2010-05-31 01:30:46 +0000
committerGravatar nadiramra2010-05-31 01:30:46 +0000
commit06cc3853ecb77ce4bc18ed6b6f30e031876e442a (patch)
tree1571614344387a5426f1e491b6477da191898425 /util/src
parent48ed88a081bc26300eb7030af451bbe830f9a89f (diff)
downloadaxis2c-06cc3853ecb77ce4bc18ed6b6f30e031876e442a.tar.gz
axis2c-06cc3853ecb77ce4bc18ed6b6f30e031876e442a.tar.bz2
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
Diffstat (limited to 'util/src')
-rw-r--r--util/src/allocator.c14
1 files 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