summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_clean.c
diff options
context:
space:
mode:
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 a8cedb4..1da8a6b 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);
}
}
OpenPOWER on IntegriCloud