summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-06-28 09:41:59 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-06-28 09:41:59 +0000
commit27c0f951b2abea7b5fca99e180fc80b9fc12c456 (patch)
tree9f184c7738226b868d3646ed8b637e60df3da951 /lib/libpthread
parente7f0429dc8d4eb4bcdf3dd9ac4d20a3eb82a5931 (diff)
downloadFreeBSD-src-27c0f951b2abea7b5fca99e180fc80b9fc12c456.zip
FreeBSD-src-27c0f951b2abea7b5fca99e180fc80b9fc12c456.tar.gz
Write new thread pointer back only when success.
Reviewed by: deischen
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/thread/thr_create.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libpthread/thread/thr_create.c b/lib/libpthread/thread/thr_create.c
index f552ee5..e9ab203 100644
--- a/lib/libpthread/thread/thr_create.c
+++ b/lib/libpthread/thread/thr_create.c
@@ -294,9 +294,10 @@ _pthread_create(pthread_t * thread, const pthread_attr_t * attr,
ret = _thr_schedule_add(curthread, new_thread);
if (ret != 0)
free_thread(curthread, new_thread);
-
- /* Return a pointer to the thread structure: */
- (*thread) = new_thread;
+ else {
+ /* Return a pointer to the thread structure: */
+ (*thread) = new_thread;
+ }
}
}
OpenPOWER on IntegriCloud