From 364bb9f49bf2d5cc61693a08a28e4a2a5af91050 Mon Sep 17 00:00:00 2001 From: stanton Date: Mon, 21 Jun 1999 19:02:02 +0000 Subject: * unix/tclUnixThrd.c (TclpThreadCreate): Fixed memory leak where thread attributes were not being released. [Bug: 2254] --- unix/tclUnixThrd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index b00bf42..cb66d08 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -72,14 +72,18 @@ TclpThreadCreate(idPtr, proc, clientData) ClientData clientData; /* The one argument to Main() */ { pthread_attr_t attr; + int result; pthread_attr_init(&attr); pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); - if (pthread_create((pthread_t *)idPtr, &attr, (void * (*)())proc, (void *)clientData) < 0) { - return TCL_ERROR; + if (pthread_create((pthread_t *)idPtr, &attr, + (void * (*)())proc, (void *)clientData) < 0) { + result = TCL_ERROR; } else { - return TCL_OK; + result = TCL_OK; } + pthread_attr_destroy(&attr); + return result; } /* -- cgit v0.12