summaryrefslogtreecommitdiffstats
path: root/crypto/cms
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-08-01 15:37:44 +0100
committerDr. Stephen Henson <steve@openssl.org>2015-08-12 14:12:02 +0100
commit056df45ed12527bea484c952227c09ad49e31d2d (patch)
treec625d8924a276ec5b0e8aa1cfdfd57a4dc72612b /crypto/cms
parente9da86627a271d9d1ad04e47115d26fab4a21c1b (diff)
Fix memory leak if setup fails.
Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 891eac4604b5f05413e59602fae1f11136f4719a) Conflicts: crypto/cms/cms_enc.c
Diffstat (limited to 'crypto/cms')
-rw-r--r--crypto/cms/cms_enc.c2
1 files changed, 1 insertions, 1 deletions
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;