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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 libmultipath/checkers/tur.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
-- 
2.10.0

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux