mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-03-01 03:06:39 +00:00
PK: Fix free(NULL) in library and tests
free() functions are documented as no-ops on NULL. Implement and test this correctly.
This commit is contained in:
@@ -77,6 +77,12 @@ void valid_parameters( )
|
||||
|
||||
mbedtls_pk_init( &pk );
|
||||
|
||||
TEST_VALID_PARAM( mbedtls_pk_free( NULL ) );
|
||||
|
||||
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
TEST_VALID_PARAM( mbedtls_pk_restart_free( NULL ) );
|
||||
#endif
|
||||
|
||||
TEST_ASSERT( mbedtls_pk_setup( &pk, NULL ) ==
|
||||
MBEDTLS_ERR_PK_BAD_INPUT_DATA );
|
||||
|
||||
@@ -133,8 +139,6 @@ void invalid_parameters( )
|
||||
|
||||
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
|
||||
TEST_INVALID_PARAM( mbedtls_pk_restart_init( NULL ) );
|
||||
|
||||
TEST_INVALID_PARAM( mbedtls_pk_restart_free( NULL ) );
|
||||
#endif
|
||||
|
||||
TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
|
||||
|
||||
Reference in New Issue
Block a user