mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-21 06:40:50 +00:00
Fix free before pointers initialised
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
f324a74fab
commit
0c2d1afaf3
@ -386,7 +386,6 @@ exit:
|
|||||||
void md_psa_dynamic_dispatch(int md_type, int pre_psa_ret, int post_psa_engine)
|
void md_psa_dynamic_dispatch(int md_type, int pre_psa_ret, int post_psa_engine)
|
||||||
{
|
{
|
||||||
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(md_type);
|
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(md_type);
|
||||||
TEST_ASSERT(md_info != NULL);
|
|
||||||
mbedtls_md_context_t ctx1, ctx2;
|
mbedtls_md_context_t ctx1, ctx2;
|
||||||
|
|
||||||
/* Intentionally no PSA init here! (Will be done later.) */
|
/* Intentionally no PSA init here! (Will be done later.) */
|
||||||
@ -394,6 +393,8 @@ void md_psa_dynamic_dispatch(int md_type, int pre_psa_ret, int post_psa_engine)
|
|||||||
mbedtls_md_init(&ctx1);
|
mbedtls_md_init(&ctx1);
|
||||||
mbedtls_md_init(&ctx2);
|
mbedtls_md_init(&ctx2);
|
||||||
|
|
||||||
|
TEST_ASSERT(md_info != NULL);
|
||||||
|
|
||||||
/* Before PSA crypto init */
|
/* Before PSA crypto init */
|
||||||
TEST_EQUAL(pre_psa_ret, mbedtls_md_setup(&ctx1, md_info, 0));
|
TEST_EQUAL(pre_psa_ret, mbedtls_md_setup(&ctx1, md_info, 0));
|
||||||
TEST_EQUAL(pre_psa_ret, mbedtls_md_setup(&ctx2, md_info, 0));
|
TEST_EQUAL(pre_psa_ret, mbedtls_md_setup(&ctx2, md_info, 0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user