diff options
author | nadiramra | 2010-05-31 03:43:54 +0000 |
---|---|---|
committer | nadiramra | 2010-05-31 03:43:54 +0000 |
commit | 2c853b4c44ff3e27ee2f0e018a983d4b08de25c2 (patch) | |
tree | ea790a3594b856a6e26ce5d93e29d812df09491b /util | |
parent | 5a2112ba79e47706779db76ddd504b89d9714f37 (diff) | |
download | axis2c-2c853b4c44ff3e27ee2f0e018a983d4b08de25c2.tar.gz axis2c-2c853b4c44ff3e27ee2f0e018a983d4b08de25c2.tar.bz2 |
AXIS2C-1473 some leaks in thread_unix.c and thread_pool.c
git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@949662 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'util')
-rw-r--r-- | util/src/platforms/os400/thread_os400.c | 17 | ||||
-rw-r--r-- | util/src/platforms/unix/thread_unix.c | 19 |
2 files changed, 13 insertions, 23 deletions
diff --git a/util/src/platforms/os400/thread_os400.c b/util/src/platforms/os400/thread_os400.c index 0269f9e..8f1abf7 100644 --- a/util/src/platforms/os400/thread_os400.c +++ b/util/src/platforms/os400/thread_os400.c @@ -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; } diff --git a/util/src/platforms/unix/thread_unix.c b/util/src/platforms/unix/thread_unix.c index ccedd06..29c5412 100644 --- a/util/src/platforms/unix/thread_unix.c +++ b/util/src/platforms/unix/thread_unix.c @@ -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; |