Fix the order of freeing memory
@@ -181,13 +181,13 @@ void mpi_mod_mul( char * input_A,
}
exit:
- mbedtls_mpi_mod_modulus_free( &m );
-
mbedtls_free( rA.p );
mbedtls_free( rB.p );
mbedtls_free( rR.p );
mbedtls_free( X );
mbedtls_free( (mbedtls_mpi_uint *) m.p );
+
+ mbedtls_mpi_mod_modulus_free( &m );
}
/* END_CASE */
@@ -233,14 +233,14 @@ void mpi_mod_mul_neg( char * input_A,
MBEDTLS_ERR_MPI_BAD_INPUT_DATA );
exit:
- mbedtls_mpi_mod_modulus_free( &m );
- mbedtls_mpi_mod_modulus_free( &fake_m );
-
mbedtls_free( rA.p );
mbedtls_free( rB.p );
mbedtls_free( rR.p );
mbedtls_free( X );
mbedtls_free( (mbedtls_mpi_uint *) m.p );
+
+ mbedtls_mpi_mod_modulus_free( &m );
+ mbedtls_mpi_mod_modulus_free( &fake_m );
}
/* END_CASE */
