diff options
author | Pauli <ppzgs1@gmail.com> | 2022-01-13 12:30:59 +1100 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-01-14 17:08:36 +1100 |
commit | 2ee3e38f8f456db4b5afb023ae0472ff79204369 (patch) | |
tree | 0ad5396cae7192c46d052dd78d2f267a23a742e3 /apps/lib/apps.c | |
parent | 941c877bdb71038f6beeaf416d9b7b7951ff1f19 (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/lib/apps.c')
-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 25a6b6bcc3..07dd4550f2 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -696,10 +696,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 { - sk_X509_pop_free(*pcerts, X509_free); - *pcerts = NULL; + if (pcerts != NULL) { + sk_X509_pop_free(*pcerts, X509_free); + *pcerts = NULL; + } } return ret; } |