Avoid a double-free in an error path.
[openssl.git] / crypto / dh / dh_ameth.c
index 2ead91ff4438a35ff0ce08df507b0f189cef5e0d..b5c9c24303b042a7fd2f30c647afdebfb18f5745 100644 (file)
@@ -283,6 +283,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(pkey->ameth->pkey_id), 0,
                          V_ASN1_SEQUENCE, params, dp, dplen))