Clear MP in ECC to free allocated memory

This commit is contained in:
Sean Parkinson
2020-08-19 08:41:36 +10:00
committed by John Safranek
parent 113753370d
commit 38b717eb42

View File

@ -2811,7 +2811,6 @@ static int ecc_point_to_mont(ecc_point* p, ecc_point* r, mp_int* modulus,
err = mp_init(mu);
if (err == MP_OKAY) {
err = mp_montgomery_calc_normalization(mu, modulus);
}
if (err == MP_OKAY) {
if (mp_cmp_d(mu, 1) == MP_EQ) {
@ -2830,6 +2829,8 @@ static int ecc_point_to_mont(ecc_point* p, ecc_point* r, mp_int* modulus,
}
}
mp_clear(mu);
}
#ifdef WOLFSSL_SMALL_STACK
if (mu != NULL)
XFREE(mu, heap, DYNAMIC_TYPE_ECC);