summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2005-10-29 18:07:55 +0000
committerkrw <krw@openbsd.org>2005-10-29 18:07:55 +0000
commitb91b10f5a69dc19f3480527da36d22e0edcb51fa (patch)
tree79a4ede5dcdec00cb23fbbb202017de148837bb0 /lib/libpthread
parentCorrect type for dd_grid, so that we print the device id correctly for (diff)
downloadwireguard-openbsd-b91b10f5a69dc19f3480527da36d22e0edcb51fa.tar.xz
wireguard-openbsd-b91b10f5a69dc19f3480527da36d22e0edcb51fa.zip
Don't use TAILQ_NEXT() on an element that has been removed. Similar to
otto@'s diff for uvm_aobj.c. ok deraadt@ pedro@
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/uthread/uthread_gc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libpthread/uthread/uthread_gc.c b/lib/libpthread/uthread/uthread_gc.c
index 85fe0590051..fdcbff1ff07 100644
--- a/lib/libpthread/uthread/uthread_gc.c
+++ b/lib/libpthread/uthread/uthread_gc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_gc.c,v 1.14 2004/04/06 03:56:39 marc Exp $ */
+/* $OpenBSD: uthread_gc.c,v 1.15 2005/10/29 18:07:55 krw Exp $ */
/*
* Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -53,7 +53,7 @@ _thread_gc(pthread_addr_t arg)
int f_done = 0;
int ret;
sigset_t mask;
- pthread_t pthread;
+ pthread_t pthread, next;
pthread_t pthread_cln;
struct timespec abstime;
void *p_stack;
@@ -115,7 +115,8 @@ _thread_gc(pthread_addr_t arg)
*/
for (pthread = TAILQ_FIRST(&_dead_list);
p_stack == NULL && pthread_cln == NULL && pthread != NULL;
- pthread = TAILQ_NEXT(pthread, dle)) {
+ pthread = next) {
+ next = TAILQ_NEXT(pthread, dle);
/* Check if the initial thread: */
if (pthread == _thread_initial) {
/* Don't destroy the initial thread. */