Fix coverity CID #1454815 - NULL ptr dereference in initthread.c

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/12708)
This commit is contained in:
Shane Lontis 2020-08-24 12:52:56 +10:00
parent 5340c8ea2a
commit 59ed733989

View File

@ -392,13 +392,14 @@ static int init_thread_deregister(void *index, int all)
for (i = 0; i < sk_THREAD_EVENT_HANDLER_PTR_num(gtr->skhands); i++) {
THREAD_EVENT_HANDLER **hands
= sk_THREAD_EVENT_HANDLER_PTR_value(gtr->skhands, i);
THREAD_EVENT_HANDLER *curr = *hands, *prev = NULL, *tmp;
THREAD_EVENT_HANDLER *curr = NULL, *prev = NULL, *tmp;
if (hands == NULL) {
if (!all)
CRYPTO_THREAD_unlock(gtr->lock);
return 0;
}
curr = *hands;
while (curr != NULL) {
if (all || curr->index == index) {
if (prev != NULL)