Date: Fri, 31 Dec 2004 14:55:01 GMT From: David Xu <davidxu@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 67976 for review Message-ID: <200412311455.iBVEt1ml009095@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=67976 Change 67976 by davidxu@davidxu_tiger on 2004/12/31 14:54:57 don't free cleanup object on stack. Affected files ... .. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_clean.c#2 edit Differences ... ==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_clean.c#2 (text+ko) ==== @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/lib/libpthread/thread/thr_clean.c,v 1.8 2003/04/18 05:04:15 deischen Exp $ + * $FreeBSD: src/lib/libpthread/thread/thr_clean.c,v 1.9 2004/12/18 18:07:37 deischen Exp $ */ #include <signal.h> #include <errno.h> @@ -50,6 +50,7 @@ malloc(sizeof(struct pthread_cleanup))) != NULL) { new->routine = routine; new->routine_arg = routine_arg; + new->onstack = 0; new->next = curthread->cleanup; curthread->cleanup = new; @@ -67,6 +68,7 @@ if (execute) { old->routine(old->routine_arg); } - free(old); + if (old->onstack == 0) + free(old); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412311455.iBVEt1ml009095>