summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-04-27 22:18:12 +0200
committerVolker Lendecke <vlendec@samba.org>2011-04-27 23:57:19 +0200
commita8a6433fec0a8dfa6a584cd7b742d469ccfa6273 (patch)
treee3680f210953e1004d33b3fc14ff73cd3116250d
parent91ebf22fa8aa5ecd9b4508b5b2c448e5edc3d151 (diff)
downloadsamba-a8a6433fec0a8dfa6a584cd7b742d469ccfa6273.tar.gz
samba-a8a6433fec0a8dfa6a584cd7b742d469ccfa6273.tar.bz2
samba-a8a6433fec0a8dfa6a584cd7b742d469ccfa6273.zip
s3: Properly clean up in pthreadpool_init in case of failure
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed Apr 27 23:57:19 CEST 2011 on sn-devel-104
-rw-r--r--source3/lib/pthreadpool/pthreadpool.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source3/lib/pthreadpool/pthreadpool.c b/source3/lib/pthreadpool/pthreadpool.c
index 3cf6cb7045..7538fb7995 100644
--- a/source3/lib/pthreadpool/pthreadpool.c
+++ b/source3/lib/pthreadpool/pthreadpool.c
@@ -120,6 +120,8 @@ int pthreadpool_init(unsigned max_threads, struct pthreadpool **presult)
ret = pthread_mutex_init(&pool->mutex, NULL);
if (ret != 0) {
+ close(pool->sig_pipe[0]);
+ close(pool->sig_pipe[1]);
free(pool);
return ret;
}
@@ -127,6 +129,8 @@ int pthreadpool_init(unsigned max_threads, struct pthreadpool **presult)
ret = pthread_cond_init(&pool->condvar, NULL);
if (ret != 0) {
pthread_mutex_destroy(&pool->mutex);
+ close(pool->sig_pipe[0]);
+ close(pool->sig_pipe[1]);
free(pool);
return ret;
}
@@ -143,6 +147,8 @@ int pthreadpool_init(unsigned max_threads, struct pthreadpool **presult)
if (ret != 0) {
pthread_cond_destroy(&pool->condvar);
pthread_mutex_destroy(&pool->mutex);
+ close(pool->sig_pipe[0]);
+ close(pool->sig_pipe[1]);
free(pool);
return ret;
}