The branch OpenSSL_1_0_2-stable has been updated
       via  13fc6b6650c43e58f23aa32cfcc9bf0ace8fb51e (commit)
      from  342843884a68a480aaa8fa5c2767c3a9a2a38bf8 (commit)


- Log -----------------------------------------------------------------
commit 13fc6b6650c43e58f23aa32cfcc9bf0ace8fb51e
Author: Dmitry Belyavskiy <[email protected]>
Date:   Sat Feb 18 20:43:01 2017 +0300

    Fix memory leak in pkcs12 -export
    
    Reviewed-by: Andy Polyakov <[email protected]>
    Reviewed-by: Rich Salz <[email protected]>
    (Merged from https://github.com/openssl/openssl/pull/2676)
    (cherry picked from commit 1b8f19379a521ec11ce37e12316dd3edc0acfb82)

-----------------------------------------------------------------------

Summary of changes:
 crypto/pkcs12/p12_mutl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/crypto/pkcs12/p12_mutl.c b/crypto/pkcs12/p12_mutl.c
index cbf34da..b1f7381 100644
--- a/crypto/pkcs12/p12_mutl.c
+++ b/crypto/pkcs12/p12_mutl.c
@@ -159,7 +159,10 @@ int PKCS12_set_mac(PKCS12 *p12, const char *pass, int 
passlen,
 int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen,
                      const EVP_MD *md_type)
 {
-    if (!(p12->mac = PKCS12_MAC_DATA_new()))
+    PKCS12_MAC_DATA_free(p12->mac);
+    p12->mac = NULL;
+
+    if ((p12->mac = PKCS12_MAC_DATA_new()) == NULL)
         return PKCS12_ERROR;
     if (iter > 1) {
         if (!(p12->mac->iter = M_ASN1_INTEGER_new())) {
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to