[Pcsclite-cvs-commit] r2615 - trunk/PCSC/src
rousseau at alioth.debian.org
rousseau at alioth.debian.org
Mon Aug 20 07:44:32 UTC 2007
Author: rousseau
Date: 2007-08-20 07:44:32 +0000 (Mon, 20 Aug 2007)
New Revision: 2615
Modified:
trunk/PCSC/src/thread_unix.c
Log:
SYS_ThreadCreate(): call pthread_attr_destroy() to free memory allocated
by pthread_attr_init()
Thanks to Paul Klissner for the bug report
Modified: trunk/PCSC/src/thread_unix.c
===================================================================
--- trunk/PCSC/src/thread_unix.c 2007-08-14 17:23:17 UTC (rev 2614)
+++ trunk/PCSC/src/thread_unix.c 2007-08-20 07:44:32 UTC (rev 2615)
@@ -48,18 +48,23 @@
PCSCLITE_THREAD_FUNCTION(pvFunction), LPVOID pvArg)
{
pthread_attr_t attr;
+ int ret = FALSE;
if (0 != pthread_attr_init(&attr))
return FALSE;
if (0 != pthread_attr_setdetachstate(&attr,
attributes & THREAD_ATTR_DETACHED ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE))
+ {
+ pthread_attr_destroy(&attr);
return FALSE;
+ }
if (0 == pthread_create(pthThread, &attr, pvFunction, pvArg))
- return TRUE;
- else
- return FALSE;
+ ret = TRUE;
+
+ pthread_attr_destroy(&attr);
+ return ret;
}
INTERNAL int SYS_ThreadCancel(PCSCLITE_THREAD_T * pthThread)
More information about the Pcsclite-cvs-commit
mailing list