mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
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)
This commit is contained in:
parent
67bfdfa17b
commit
b36e677f8f
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user