From 891eac4604b5f05413e59602fae1f11136f4719a Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Sat, 1 Aug 2015 15:37:44 +0100 Subject: [PATCH] Fix memory leak if setup fails. Reviewed-by: Matt Caswell --- crypto/cms/cms_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/cms/cms_enc.c b/crypto/cms/cms_enc.c index f9556acc2e..16b42251d1 100644 --- a/crypto/cms/cms_enc.c +++ b/crypto/cms/cms_enc.c @@ -194,7 +194,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) ok = 1; err: - if (!keep_key) { + if (!keep_key || !ok) { OPENSSL_clear_free(ec->key, ec->keylen); ec->key = NULL; } -- 2.25.1