diff mbox

[10/15] libmultipath/checkers/tur: Move pthread_attr_destroy() call

Message ID 69406132-f1a4-179f-1f3e-abbc4a66ec08@sandisk.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show

Commit Message

Bart Van Assche Oct. 4, 2016, 5:40 p.m. UTC
Move the pthread_attr_destroy() call up such that this function
is also called if thread creation fails.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
---
 libmultipath/checkers/tur.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c
index 3f97f2a..11f3c60 100644
--- a/libmultipath/checkers/tur.c
+++ b/libmultipath/checkers/tur.c
@@ -333,6 +333,7 @@  libcheck_check (struct checker * c)
 		tur_set_async_timeout(c);
 		setup_thread_attr(&attr, 32 * 1024, 1);
 		r = pthread_create(&ct->thread, &attr, tur_thread, ct);
+		pthread_attr_destroy(&attr);
 		if (r) {
 			pthread_spin_lock(&ct->hldr_lock);
 			ct->holders--;
@@ -343,7 +344,6 @@  libcheck_check (struct checker * c)
 				" sync mode", TUR_DEVT(ct));
 			return tur_check(c->fd, c->timeout, c->message);
 		}
-		pthread_attr_destroy(&attr);
 		tur_timeout(&tsp);
 		r = pthread_cond_timedwait(&ct->active, &ct->lock, &tsp);
 		tur_status = ct->state;