summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thr_clean.c
diff options
context:
space:
mode:
authorDaniel Eischen <deischen@FreeBSD.org>2004-12-18 18:07:37 +0000
committerDaniel Eischen <deischen@FreeBSD.org>2004-12-18 18:07:37 +0000
commit843d4004b367db61428fa1cbf611cdbd2791d672 (patch)
tree3341fdd3fcdb8d611509d7622be5b25f271de80a /lib/libpthread/thread/thr_clean.c
parent885dabe5f70ceac846c6d0623c64914d5c401f10 (diff)
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_clean.c')
-rw-r--r--lib/libpthread/thread/thr_clean.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_clean.c b/lib/libpthread/thread/thr_clean.c
index a8cedb43962f..1da8a6b592db 100644
--- a/lib/libpthread/thread/thr_clean.c
+++ b/lib/libpthread/thread/thr_clean.c
@@ -50,6 +50,7 @@ _pthread_cleanup_push(void (*routine) (void *), void *routine_arg)
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 @@ _pthread_cleanup_pop(int execute)
if (execute) {
old->routine(old->routine_arg);
}
- free(old);
+ if (old->onstack == 0)
+ free(old);
}
}