Avoid a double-free in an error path.
authorDoug Hogan <doug@acyclic.org>
Thu, 8 Jan 2015 02:21:01 +0000 (18:21 -0800)
committerKurt Roeckx <kurt@roeckx.be>
Sun, 22 Feb 2015 12:27:19 +0000 (13:27 +0100)
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 1549a265209d449b6aefd2b49d7d39f7fbe0689b)

crypto/dh/dh_ameth.c

index 0ba4d44..76df91b 100644 (file)
@@ -258,6 +258,7 @@ static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
     dplen = i2d_ASN1_INTEGER(prkey, &dp);
 
     ASN1_INTEGER_free(prkey);
+    prkey = NULL;
 
     if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_dhKeyAgreement), 0,
                          V_ASN1_SEQUENCE, params, dp, dplen))