Fix the order of freeing memory

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
Gabor Mezei 2022-12-20 13:55:37 +01:00
parent 61fd1fb4b1
commit f9728137d8
No known key found for this signature in database
GPG key ID: F072ACA227ACD71D

View file

@ -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 */