Fix memory leak if setup fails.

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 891eac4604)

Conflicts:
	crypto/cms/cms_enc.c
This commit is contained in:
Dr. Stephen Henson 2015-08-01 15:37:44 +01:00
parent e9da86627a
commit 056df45ed1

View file

@ -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;