summaryrefslogtreecommitdiff
path: root/pthread/pt-detach.c
diff options
context:
space:
mode:
Diffstat (limited to 'pthread/pt-detach.c')
-rw-r--r--pthread/pt-detach.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pthread/pt-detach.c b/pthread/pt-detach.c
index 1e42c45..4ed8d2c 100644
--- a/pthread/pt-detach.c
+++ b/pthread/pt-detach.c
@@ -66,9 +66,11 @@ pthread_detach (pthread_t thread)
/* Destroy the stack, the kernel resources and the control
block. */
- assert (pthread->stack);
- __pthread_stack_dealloc (pthread->stackaddr, pthread->stacksize);
- pthread->stack = 0;
+ if (pthread->stack)
+ {
+ __pthread_stack_dealloc (pthread->stackaddr, pthread->stacksize);
+ pthread->stack = 0;
+ }
__pthread_thread_dealloc (pthread);