diff options
author | deischen <deischen@FreeBSD.org> | 2005-08-29 13:49:18 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2005-08-29 13:49:18 +0000 |
commit | 64b6610e61c24c5d43e5a4cd9b1e6b2e309ad26f (patch) | |
tree | beda97139efb78dbe127d83d9f162ef835e71f68 /lib/libkse | |
parent | edebe2a2bd14afa5413045efa67c0163afc57a02 (diff) | |
download | FreeBSD-src-64b6610e61c24c5d43e5a4cd9b1e6b2e309ad26f.zip FreeBSD-src-64b6610e61c24c5d43e5a4cd9b1e6b2e309ad26f.tar.gz |
Handle failure to malloc() part of the thread structure.
PR: 83457
Diffstat (limited to 'lib/libkse')
-rw-r--r-- | lib/libkse/thread/thr_kern.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c index aec2541..85d9b33 100644 --- a/lib/libkse/thread/thr_kern.c +++ b/lib/libkse/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 |