From 056df45ed12527bea484c952227c09ad49e31d2d 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 (cherry picked from commit 891eac4604b5f05413e59602fae1f11136f4719a) Conflicts: crypto/cms/cms_enc.c --- 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 85ae928a49..b14b4b68b5 100644 --- a/crypto/cms/cms_enc.c +++ b/crypto/cms/cms_enc.c @@ -195,7 +195,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) ok = 1; err: - if (ec->key && !keep_key) { + if (ec->key && (!keep_key || !ok)) { OPENSSL_cleanse(ec->key, ec->keylen); OPENSSL_free(ec->key); ec->key = NULL; -- 2.25.1