From: Matt Caswell Date: Wed, 27 Apr 2016 12:22:29 +0000 (+0100) Subject: Don't leak EVP_MD_CTX on error path X-Git-Tag: OpenSSL_1_1_0-pre6~1032 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=2280358146b620647c51a5b940dd9104c4ea3a3f Don't leak EVP_MD_CTX on error path The cms_SignerInfo_content_sign() function allocated an EVP_MD_CTX but then failed to free it on an error path. Reviewed-by: Richard Levitte --- diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c index 151f40f9a5..e4739b39d9 100644 --- a/crypto/cms/cms_sd.c +++ b/crypto/cms/cms_sd.c @@ -588,7 +588,7 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, if (!si->pkey) { CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, CMS_R_NO_PRIVATE_KEY); - return 0; + goto err; } if (!cms_DigestAlgorithm_find_ctx(mctx, chain, si->digestAlgorithm))