Commit 13fc6b66 authored by Dmitry Belyavskiy's avatar Dmitry Belyavskiy Committed by Rich Salz
Browse files

Fix memory leak in pkcs12 -export



Reviewed-by: default avatarAndy Polyakov <appro@openssl.org>
Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2676)
(cherry picked from commit 1b8f1937)
parent 34284388
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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())) {