You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by se...@apache.org on 2008/03/19 10:53:42 UTC

svn commit: r638767 - /webservices/axis2/trunk/c/util/src/hash.c

Author: senaka
Date: Wed Mar 19 02:53:41 2008
New Revision: 638767

URL: http://svn.apache.org/viewvc?rev=638767&view=rev
Log:
Fixing bug in hash creation: adding NULL check on MALLOC() failure.

Modified:
    webservices/axis2/trunk/c/util/src/hash.c

Modified: webservices/axis2/trunk/c/util/src/hash.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/hash.c?rev=638767&r1=638766&r2=638767&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/hash.c (original)
+++ webservices/axis2/trunk/c/util/src/hash.c Wed Mar 19 02:53:41 2008
@@ -65,8 +65,8 @@
     const axutil_env_t *env;
     axutil_hash_entry_t **array;
     axutil_hash_index_t iterator;   /* For axutil_hash_first(NULL, ...) */
-    unsigned int count,
-     max;
+    unsigned int count;
+    unsigned int max;
     axutil_hashfunc_t hash_func;
     axutil_hash_entry_t *free;  /* List of recycled entries */
 };
@@ -95,6 +95,11 @@
     AXIS2_ENV_CHECK(env, NULL);
 
     ht = AXIS2_MALLOC(env->allocator, sizeof(axutil_hash_t));
+    if (!ht)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
     axutil_env_increment_ref((axutil_env_t*)env);
     ht->env = env;
     ht->free = NULL;
@@ -113,7 +118,10 @@
     axutil_hash_t *ht;
     AXIS2_ENV_CHECK(env, NULL);
     ht = axutil_hash_make(env);
-    ht->hash_func = hash_func;
+    if (ht)
+    {
+        ht->hash_func = hash_func;
+    }
     return ht;
 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org