aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJason Evans <jasone@FreeBSD.org>2000-05-16 21:57:12 +0000
committerJason Evans <jasone@FreeBSD.org>2000-05-16 21:57:12 +0000
commit40316fa9812750f08462dd32cab884c0b331fc54 (patch)
tree67604707bb00f7adc4150db4b02ad01e1caa9790 /lib
parent9b44277a7325213a1d291aedfb886e1b7215e0d8 (diff)
downloadsrc-40316fa9812750f08462dd32cab884c0b331fc54.tar.gz
src-40316fa9812750f08462dd32cab884c0b331fc54.zip
Fix a memory leak. pthread_set_name_np() allocates space for a name, but
_thread_gc() was not deallocating it. PR: misc/18504
Notes
Notes: svn path=/head/; revision=60656
Diffstat (limited to 'lib')
-rw-r--r--lib/libc_r/uthread/uthread_gc.c4
-rw-r--r--lib/libpthread/thread/thr_gc.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/libc_r/uthread/uthread_gc.c b/lib/libc_r/uthread/uthread_gc.c
index a6ffd4ba58d7..cd1f8383a33d 100644
--- a/lib/libc_r/uthread/uthread_gc.c
+++ b/lib/libc_r/uthread/uthread_gc.c
@@ -242,6 +242,10 @@ _thread_gc(pthread_addr_t arg)
if (p_stack != NULL)
free(p_stack);
if (pthread_cln != NULL)
+ if (pthread_cln->name != NULL) {
+ /* Free the thread name string. */
+ free(pthread_cln->name);
+ }
/*
* Free the memory allocated for the thread
* structure.
diff --git a/lib/libpthread/thread/thr_gc.c b/lib/libpthread/thread/thr_gc.c
index a6ffd4ba58d7..cd1f8383a33d 100644
--- a/lib/libpthread/thread/thr_gc.c
+++ b/lib/libpthread/thread/thr_gc.c
@@ -242,6 +242,10 @@ _thread_gc(pthread_addr_t arg)
if (p_stack != NULL)
free(p_stack);
if (pthread_cln != NULL)
+ if (pthread_cln->name != NULL) {
+ /* Free the thread name string. */
+ free(pthread_cln->name);
+ }
/*
* Free the memory allocated for the thread
* structure.