diff options
author | Pauli <ppzgs1@gmail.com> | 2022-01-13 12:30:59 +1100 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-01-14 17:06:22 +1100 |
commit | 8c870f6bed241ec80c67453e60592461f0d8f2b8 (patch) | |
tree | 3e630017506b71aa685b31d0225b3740d6160be4 /apps | |
parent | 79c7acc59bb98c2b8451b048ed1dd8cc517df76e (diff) |
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)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lib/apps.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/lib/apps.c b/apps/lib/apps.c index 7ca30ef590..77edc1d936 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -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; } |