axis-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r949639 - /axis/axis2/c/core/trunk/util/src/allocator.c
Date Mon, 31 May 2010 01:30:46 GMT
Author: nadiramra
Date: Mon May 31 01:30:46 2010
New Revision: 949639

URL: http://svn.apache.org/viewvc?rev=949639&view=rev
Log:
AXIS2C-1461 axutil_allocator_init(): unsafe memset() call

Modified:
    axis/axis2/c/core/trunk/util/src/allocator.c

Modified: axis/axis2/c/core/trunk/util/src/allocator.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/util/src/allocator.c?rev=949639&r1=949638&r2=949639&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/util/src/allocator.c (original)
+++ axis/axis2/c/core/trunk/util/src/allocator.c Mon May 31 01:30:46 2010
@@ -37,24 +37,20 @@ AXIS2_EXTERN axutil_allocator_t *AXIS2_C
 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



Mime
View raw message