summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc_r/uthread/uthread_gc.c10
-rw-r--r--lib/libpthread/uthread/uthread_gc.c10
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/libc_r/uthread/uthread_gc.c b/lib/libc_r/uthread/uthread_gc.c
index 32d79b5dfac..34df4613b30 100644
--- a/lib/libc_r/uthread/uthread_gc.c
+++ b/lib/libc_r/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.
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.