Skip to content

Commit

Permalink
Coverity 1521490: resource leak
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from #20504)
  • Loading branch information
paulidale committed Mar 15, 2023
1 parent 67bfdfa commit b36e677
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ssl/ssl_cert.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit b36e677

Please sign in to comment.