From e0dab2eb3c7710a5b6de64b62a20b3b4861e7e88 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Sat, 1 Aug 2015 15:37:44 +0100 Subject: 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 85ae928..b14b4b6 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; -- 1.7.12.1