summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread/uthread_gc.c
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1998-12-21 07:39:35 +0000
committerDavid Leonard <d@cvs.openbsd.org>1998-12-21 07:39:35 +0000
commit447e300b19ab34eecb05ea8f02915e0de86ad626 (patch)
treed6f8711be29c3ccc09e7f84cad41c780add73877 /lib/libpthread/uthread/uthread_gc.c
parent69847ffd49fe9d27634700feb8c49b79dec89d2f (diff)
memory leak
Diffstat (limited to 'lib/libpthread/uthread/uthread_gc.c')
-rw-r--r--lib/libpthread/uthread/uthread_gc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libpthread/uthread/uthread_gc.c b/lib/libpthread/uthread/uthread_gc.c
index 32d79b5dfac..34df4613b30 100644
--- a/lib/libpthread/uthread/uthread_gc.c
+++ b/lib/libpthread/uthread/uthread_gc.c
@@ -29,8 +29,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: uthread_gc.c,v 1.1 1998/11/09 03:13:19 d Exp $
- * $OpenBSD: uthread_gc.c,v 1.1 1998/11/09 03:13:19 d Exp $
+ * $Id: uthread_gc.c,v 1.2 1998/12/21 07:39:34 d Exp $
+ * $OpenBSD: uthread_gc.c,v 1.2 1998/12/21 07:39:34 d Exp $
*
* Garbage collector thread. Frees memory allocated for dead threads.
*
@@ -63,7 +63,7 @@ _thread_gc(pthread_addr_t arg)
f_debug = (getenv("LIBC_R_DEBUG") != NULL);
/* Set the name of this thread. */
- pthread_set_name_np(_thread_run,"GC");
+ pthread_set_name_np(_thread_run, "GC");
while (!f_done) {
/* Check if debugging this application. */
@@ -265,6 +265,10 @@ _thread_gc(pthread_addr_t arg)
/* Unlock the thread list: */
_unlock_thread_list();
+ /* Free memory allocated for the thread's name: */
+ if (pthread_cln->name != NULL)
+ free(pthread_cln->name);
+
/*
* Free the memory allocated for the thread
* structure.