Merge pull request #3762 from guidovranken/zd11732

Fix memory leak in fp_gcd
This commit is contained in:
David Garske 2021-02-16 13:04:10 -08:00 committed by GitHub
commit cc37227f18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5279,6 +5279,9 @@ int fp_gcd(fp_int *a, fp_int *b, fp_int *c)
while (fp_iszero(v) == FP_NO) {
int err = fp_mod(u, v, r);
if (err != MP_OKAY) {
#ifdef WOLFSSL_SMALL_STACK
XFREE(u, NULL, DYNAMIC_TYPE_BIGINT);
#endif
return err;
}
fp_copy(v, u);