cms_SignerInfo_content_sign: free sig on failure path
authorJonas Maebe <jonas.maebe@elis.ugent.be>
Sun, 8 Dec 2013 16:16:57 +0000 (17:16 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Fri, 15 Aug 2014 20:38:19 +0000 (22:38 +0200)
Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/cms/cms_sd.c

index ac5103a..681ee7e 100644 (file)
@@ -680,7 +680,10 @@ static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms,
                        goto err;
                        }
                if (EVP_PKEY_sign(pctx, sig, &siglen, md, mdlen) <= 0)
                        goto err;
                        }
                if (EVP_PKEY_sign(pctx, sig, &siglen, md, mdlen) <= 0)
+                       {
+                       OPENSSL_free(sig);
                        goto err;
                        goto err;
+                       }
                ASN1_STRING_set0(si->signature, sig, siglen);
                }
        else
                ASN1_STRING_set0(si->signature, sig, siglen);
                }
        else