coverity 1497107: dereference after null check

Add null checks to avoid dereferencing a pointer that could be null.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/17488)
This commit is contained in:
Pauli 2022-01-13 12:30:59 +11:00 committed by Pauli
parent 79c7acc59b
commit 8c870f6bed
1 changed files with 6 additions and 3 deletions

View File

@ -691,10 +691,13 @@ int load_cert_certs(const char *uri,
if (ret) {
if (pcert != NULL)
warn_cert(uri, *pcert, 0, vpm);
warn_certs(uri, *pcerts, 1, vpm);
if (pcerts != NULL)
warn_certs(uri, *pcerts, 1, vpm);
} else {
OSSL_STACK_OF_X509_free(*pcerts);
*pcerts = NULL;
if (pcerts != NULL) {
OSSL_STACK_OF_X509_free(*pcerts);
*pcerts = NULL;
}
}
return ret;
}