mirror of
https://github.com/samba-team/samba.git
synced 2025-03-01 04:58:35 +03:00
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
This commit is contained in:
parent
91ebf22fa8
commit
a8a6433fec
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user