summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2005-08-29 13:49:18 +0000
committerdeischen <deischen@FreeBSD.org>2005-08-29 13:49:18 +0000
commit64b6610e61c24c5d43e5a4cd9b1e6b2e309ad26f (patch)
treebeda97139efb78dbe127d83d9f162ef835e71f68 /lib/libpthread
parentedebe2a2bd14afa5413045efa67c0163afc57a02 (diff)
downloadFreeBSD-src-64b6610e61c24c5d43e5a4cd9b1e6b2e309ad26f.zip
FreeBSD-src-64b6610e61c24c5d43e5a4cd9b1e6b2e309ad26f.tar.gz
Handle failure to malloc() part of the thread structure.
PR: 83457
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/thread/thr_kern.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c
index aec2541..85d9b33 100644
--- a/lib/libpthread/thread/thr_kern.c
+++ b/lib/libpthread/thread/thr_kern.c
@@ -2372,12 +2372,13 @@ _thr_alloc(struct pthread *curthread)
} else {
thread->tcb = _tcb_ctor(thread, 1 /* initial tls */);
}
- if (thread->tcb == NULL) {
+ thread->siginfo = calloc(_SIG_MAXSIG, sizeof(siginfo_t));
+ if ((thread->tcb == NULL) || (thread->siginfo == NULL)) {
+ if (thread->siginfo != NULL)
+ free(thread->siginfo);
free(thread);
thread = NULL;
} else {
- thread->siginfo = calloc(_SIG_MAXSIG,
- sizeof(siginfo_t));
/*
* Initialize thread locking.
* Lock initializing needs malloc, so don't
OpenPOWER on IntegriCloud