Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 May 1999 14:22:27 -0700 (PDT)
From:      rse@engelschall.com
To:        freebsd-gnats-submit@freebsd.org
Subject:   i386/11713: memory leak and/or crash in uthread's destructor-calling function
Message-ID:  <19990514212227.65D4415095@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         11713
>Category:       i386
>Synopsis:       memory leak and/or crash in uthread's destructor-calling function
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 14 14:30:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Ralf S. Engelschall
>Release:        3.1
>Organization:
Cable & Wireless ECRC 
>Environment:
FreeBSD en1.engelschall.com 3.1-RELEASE FreeBSD 3.1-RELEASE #4: Sun Feb 28 18:55:02 CET 1999     rse@en1.engelschall.com:/usr/src/sys/compile/EN1  i386
>Description:
The uthread constructor calling function _thread_cleanupspecific
in /usr/src/lib/libc_r/uthread/uthread_spec.c does
the final free too late. The override with NULL has
to occur after the free and not before.
>How-To-Repeat:
I've seen this by poking around in the sources
and not by using the stuff. But I guess a memory leak or
even a crash could occur because of the free(NULL)
when pthread_key_create() was used in an application.
>Fix:
--- uthread_spec.c.orig Fri May 14 23:14:53 1999
+++ uthread_spec.c      Fri May 14 23:15:32 1999
@@ -124,8 +124,8 @@
                        }
                }
        }
-       _thread_run->specific_data = NULL;
        free(_thread_run->specific_data);
+       _thread_run->specific_data = NULL;
 }
 
 static inline const void **


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990514212227.65D4415095>