diff --git a/library/bignum.c b/library/bignum.c index 30757dfbf9..5f5df78e1b 100644 --- a/library/bignum.c +++ b/library/bignum.c @@ -2426,7 +2426,8 @@ static int mpi_miller_rabin( const mbedtls_mpi *X, size_t rounds, } if (count++ > 30) { - return MBEDTLS_ERR_MPI_NOT_ACCEPTABLE; + ret = MBEDTLS_ERR_MPI_NOT_ACCEPTABLE; + goto cleanup; } } while ( mbedtls_mpi_cmp_mpi( &A, &W ) >= 0 ||