From: Dr. Stephen Henson Date: Sat, 1 Aug 2015 14:37:44 +0000 (+0100) Subject: Fix memory leak if setup fails. X-Git-Tag: OpenSSL_1_0_1q~100 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2d172503687dd4c05193edf4d8242625fedc5806;p=oweals%2Fopenssl.git Fix memory leak if setup fails. Reviewed-by: Matt Caswell (cherry picked from commit 891eac4604b5f05413e59602fae1f11136f4719a) Conflicts: crypto/cms/cms_enc.c --- 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;