test: fix coverity 1475941: resource leak

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14769)
This commit is contained in:
Pauli 2021-04-04 17:58:32 +10:00 committed by Pauli
parent ccf19c23c0
commit 97ef45ea13

View File

@ -257,8 +257,10 @@ static int dh_computekey_range_test(void)
goto err;
if (!TEST_true(BN_set_word(priv, 1))
|| !TEST_true(DH_set0_key(dh, NULL, priv))
|| !TEST_true(BN_set_word(pub, 1)))
|| !TEST_true(DH_set0_key(dh, NULL, priv)))
goto err;
priv = NULL;
if (!TEST_true(BN_set_word(pub, 1)))
goto err;
/* Given z = pub ^ priv mod p */
@ -282,6 +284,7 @@ static int dh_computekey_range_test(void)
ret = 1;
err:
OPENSSL_free(buf);
BN_free(priv);
BN_free(pub);
BN_free(g);
BN_free(q);