axis-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r949662 - in /axis/axis2/c/core/trunk/util/src/platforms: os400/thread_os400.c unix/thread_unix.c
Date Mon, 31 May 2010 03:43:54 GMT
Author: nadiramra
Date: Mon May 31 03:43:54 2010
New Revision: 949662

URL: http://svn.apache.org/viewvc?rev=949662&view=rev
Log:
AXIS2C-1473 some leaks in thread_unix.c and thread_pool.c

Modified:
    axis/axis2/c/core/trunk/util/src/platforms/os400/thread_os400.c
    axis/axis2/c/core/trunk/util/src/platforms/unix/thread_unix.c

Modified: axis/axis2/c/core/trunk/util/src/platforms/os400/thread_os400.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/util/src/platforms/os400/thread_os400.c?rev=949662&r1=949661&r2=949662&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/util/src/platforms/os400/thread_os400.c (original)
+++ axis/axis2/c/core/trunk/util/src/platforms/os400/thread_os400.c Mon May 31 03:43:54 2010
@@ -28,11 +28,9 @@ axutil_threadattr_create(
 
     new = AXIS2_MALLOC(allocator, sizeof(axutil_threadattr_t));
     if (!new)
-    {
         return NULL;
-    }
-    stat = pthread_attr_init(&(new->attr));
 
+    stat = pthread_attr_init(&(new->attr));
     if (stat != 0)
     {
         AXIS2_FREE(allocator, new);
@@ -107,12 +105,12 @@ axutil_thread_create(
     new = (axutil_thread_t *) AXIS2_MALLOC(allocator, sizeof(axutil_thread_t));
 
     if (!new)
-    {
         return NULL;
-    }
+
     new->td = (pthread_t *) AXIS2_MALLOC(allocator, sizeof(pthread_t));
     if (!new->td)
     {
+        AXIS2_FREE(allocator, new);
         return NULL;
     }
 
@@ -121,18 +119,15 @@ axutil_thread_create(
     new->try_exit = AXIS2_FALSE;
 
     if (attr)
-    {
         temp = &(attr->attr);
-    }
-    else
-    {
-        temp = NULL;
-    }
 
     if ((stat = pthread_create(new->td, temp, dummy_worker, new)) == 0)
     {
         return new;
     }
+
+    AXIS2_FREE(allocator, new->td);
+    AXIS2_FREE(allocator, new);
     return NULL;
 }
 

Modified: axis/axis2/c/core/trunk/util/src/platforms/unix/thread_unix.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/util/src/platforms/unix/thread_unix.c?rev=949662&r1=949661&r2=949662&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/util/src/platforms/unix/thread_unix.c (original)
+++ axis/axis2/c/core/trunk/util/src/platforms/unix/thread_unix.c Mon May 31 03:43:54 2010
@@ -27,9 +27,8 @@ axutil_threadattr_create(
 
     new = AXIS2_MALLOC(allocator, sizeof(axutil_threadattr_t));
     if(!new)
-    {
         return NULL;
-    }
+
     stat = pthread_attr_init(&(new->attr));
 
     if(stat != 0)
@@ -104,14 +103,13 @@ axutil_thread_create(
     axutil_thread_t *new = NULL;
 
     new = (axutil_thread_t *)AXIS2_MALLOC(allocator, sizeof(axutil_thread_t));
-
     if(!new)
-    {
         return NULL;
-    }
+
     new->td = (pthread_t *)AXIS2_MALLOC(allocator, sizeof(pthread_t));
     if(!new->td)
     {
+        AXIS2_FREE(allocator, new);
         return NULL;
     }
 
@@ -120,18 +118,15 @@ axutil_thread_create(
     new->try_exit = AXIS2_FALSE;
 
     if(attr)
-    {
         temp = &(attr->attr);
-    }
-    else
-    {
-        temp = NULL;
-    }
 
     if((stat = pthread_create(new->td, temp, dummy_worker, new)) == 0)
     {
         return new;
     }
+
+    AXIS2_FREE(allocator, new->td);
+    AXIS2_FREE(allocator, new);
     return NULL;
 }
 
@@ -296,7 +291,7 @@ axutil_thread_once_init(
     axutil_thread_once_t *control = AXIS2_MALLOC(allocator, sizeof(axutil_thread_once_t));
     if(!control)
     {
-        return NULL;;
+        return NULL;
     }
     (control)->once = once_init;
     return control;



Mime
View raw message