diff options
author | David Leonard <d@cvs.openbsd.org> | 1998-12-21 07:39:35 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1998-12-21 07:39:35 +0000 |
commit | 447e300b19ab34eecb05ea8f02915e0de86ad626 (patch) | |
tree | d6f8711be29c3ccc09e7f84cad41c780add73877 | |
parent | 69847ffd49fe9d27634700feb8c49b79dec89d2f (diff) |
memory leak
-rw-r--r-- | lib/libc_r/uthread/uthread_gc.c | 10 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_gc.c | 10 |
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. |