From a8a6433fec0a8dfa6a584cd7b742d469ccfa6273 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 27 Apr 2011 22:18:12 +0200 Subject: s3: Properly clean up in pthreadpool_init in case of failure Autobuild-User: Volker Lendecke Autobuild-Date: Wed Apr 27 23:57:19 CEST 2011 on sn-devel-104 --- source3/lib/pthreadpool/pthreadpool.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source3/lib') 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; } -- cgit