diff options
author | Pauli <pauli@openssl.org> | 2023-03-14 12:04:11 +1100 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-03-15 19:58:07 +1100 |
commit | b36e677f8f563301207ea658e29b3a8f88c2951b (patch) | |
tree | 11620fec6227f72160af77fb6ec58151734dd95c /ssl | |
parent | 67bfdfa17bc4ca8e2b819316299bb82748394c45 (diff) |
Coverity 1521490: resource leak
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/20504)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/ssl_cert.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index 1c4f452997..f35ec2ab68 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -106,14 +106,17 @@ CERT *ssl_cert_dup(CERT *cert) ret->ssl_pkey_num = cert->ssl_pkey_num; ret->pkeys = OPENSSL_zalloc(ret->ssl_pkey_num * sizeof(CERT_PKEY)); - if (ret->pkeys == NULL) + if (ret->pkeys == NULL) { + OPENSSL_free(ret); return NULL; + } ret->references = 1; ret->key = &ret->pkeys[cert->key - cert->pkeys]; ret->lock = CRYPTO_THREAD_lock_new(); if (ret->lock == NULL) { ERR_raise(ERR_LIB_SSL, ERR_R_CRYPTO_LIB); + OPENSSL_free(ret->pkeys); OPENSSL_free(ret); return NULL; } |