Handle failure to malloc() part of the thread structure.

PR:	83457
This commit is contained in:
Daniel Eischen 2005-08-29 13:49:18 +00:00
parent c7c5df6fdb
commit f12a8f9703
2 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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