mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-25 21:17:45 +00:00
Correct memory leak in RSA test suite
The test for `mbedtls_rsa_import_raw` didn't include freeing the allocate buffers.
This commit is contained in:
parent
7471631dde
commit
3f3ae85e11
1 changed files with 7 additions and 4 deletions
|
@ -1329,20 +1329,19 @@ void mbedtls_rsa_import_raw( char *input_N,
|
|||
size_t lenE = 0;
|
||||
|
||||
mbedtls_rsa_context ctx;
|
||||
|
||||
mbedtls_entropy_context entropy;
|
||||
mbedtls_ctr_drbg_context ctr_drbg;
|
||||
|
||||
const char *pers = "test_suite_rsa";
|
||||
|
||||
mbedtls_ctr_drbg_init( &ctr_drbg );
|
||||
|
||||
mbedtls_entropy_init( &entropy );
|
||||
mbedtls_rsa_init( &ctx, 0, 0 );
|
||||
|
||||
TEST_ASSERT( mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func,
|
||||
&entropy, (const unsigned char *) pers,
|
||||
strlen( pers ) ) == 0 );
|
||||
|
||||
mbedtls_rsa_init( &ctx, 0, 0 );
|
||||
|
||||
if( strlen( input_N ) )
|
||||
lenN = unhexify( bufN, input_N );
|
||||
|
||||
|
@ -1437,6 +1436,10 @@ void mbedtls_rsa_import_raw( char *input_N,
|
|||
|
||||
exit:
|
||||
|
||||
mbedtls_free( buf_orig );
|
||||
mbedtls_free( buf_enc );
|
||||
mbedtls_free( buf_dec );
|
||||
|
||||
mbedtls_rsa_free( &ctx );
|
||||
|
||||
mbedtls_ctr_drbg_free( &ctr_drbg );
|
||||
|
|
Loading…
Reference in a new issue