From 2c7464724eb4ad57785763b583bb057296af4450 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <roam@ringlet.net>
Date: Fri, 11 Mar 2011 12:21:20 +0200
Subject: [PATCH 2/2] Destroy a pthread attribute after using it.

---
 src/sthreads.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/sthreads.c b/src/sthreads.c
index 613991f..e40dbe6 100644
--- a/src/sthreads.c
+++ b/src/sthreads.c
@@ -313,6 +313,7 @@ int create_client(int ls, int s, CLI *arg, void *(*cli)(void *)) {
     pthread_sigmask(SIG_BLOCK, &newmask, &oldmask); /* block signals */
 #endif /* HAVE_PTHREAD_SIGMASK */
     if(pthread_create(&thread, &pth_attr, cli, arg)) {
+        pthread_attr_destroy(&pth_attr);
 #ifdef HAVE_PTHREAD_SIGMASK
         pthread_sigmask(SIG_SETMASK, &oldmask, NULL); /* restore the mask */
 #endif /* HAVE_PTHREAD_SIGMASK */
@@ -325,6 +326,7 @@ int create_client(int ls, int s, CLI *arg, void *(*cli)(void *)) {
 #ifdef HAVE_PTHREAD_SIGMASK
     pthread_sigmask(SIG_SETMASK, &oldmask, NULL); /* restore the mask */
 #endif /* HAVE_PTHREAD_SIGMASK */
+    pthread_attr_destroy(&pth_attr);
     return 0;
 }
 
-- 
1.7.2.3

