From: Pauli Date: Thu, 18 Mar 2021 02:59:40 +0000 (+1000) Subject: rsa: fix coverity 1472658: resource leak X-Git-Tag: openssl-3.0.0-alpha14~187 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bca681aa5b2539c1e50072a2034ef2f5414bb61c;p=thirdparty%2Fopenssl.git rsa: fix coverity 1472658: resource leak Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14596) --- diff --git a/providers/implementations/asymciphers/rsa_enc.c b/providers/implementations/asymciphers/rsa_enc.c index 34ce13dd305..621239d79e3 100644 --- a/providers/implementations/asymciphers/rsa_enc.c +++ b/providers/implementations/asymciphers/rsa_enc.c @@ -250,6 +250,7 @@ static int rsa_decrypt(void *vprsactx, unsigned char *out, size_t *outlen, if (prsactx->oaep_md == NULL) { prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA-1", NULL); if (prsactx->oaep_md == NULL) { + OPENSSL_free(tbuf); ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR); return 0; } @@ -264,6 +265,7 @@ static int rsa_decrypt(void *vprsactx, unsigned char *out, size_t *outlen, /* RSA_PKCS1_WITH_TLS_PADDING */ if (prsactx->client_version <= 0) { ERR_raise(ERR_LIB_PROV, PROV_R_BAD_TLS_CLIENT_VERSION); + OPENSSL_free(tbuf); return 0; } ret = ossl_rsa_padding_check_PKCS1_type_2_TLS(