mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-05-09 03:04:24 +02:00
Remove largely useless bit of test log to silence GCC 12
GCC 12 emits a warning because it thinks `buffer1` is used after having been freed. The code is correct C because we're only using the value of `(uintptr_t)buffer1`, not `buffer1`. However, we aren't using the value for anything useful: it doesn't really matter if an alloc-free-alloc sequence returns the same address twice. So don't print that bit of information, and this way we don't need to save the old address. Fixes #5974. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -89,7 +89,6 @@ static int calloc_self_test( int verbose )
|
||||
void *empty2 = mbedtls_calloc( 0, 1 );
|
||||
void *buffer1 = mbedtls_calloc( 1, 1 );
|
||||
void *buffer2 = mbedtls_calloc( 1, 1 );
|
||||
uintptr_t old_buffer1;
|
||||
|
||||
if( empty1 == NULL && empty2 == NULL )
|
||||
{
|
||||
@@ -131,7 +130,6 @@ static int calloc_self_test( int verbose )
|
||||
mbedtls_printf( " CALLOC(1): passed\n" );
|
||||
}
|
||||
|
||||
old_buffer1 = (uintptr_t) buffer1;
|
||||
mbedtls_free( buffer1 );
|
||||
buffer1 = mbedtls_calloc( 1, 1 );
|
||||
if( buffer1 == NULL )
|
||||
@@ -143,9 +141,7 @@ static int calloc_self_test( int verbose )
|
||||
else
|
||||
{
|
||||
if( verbose )
|
||||
mbedtls_printf( " CALLOC(1 again): passed (%s address)\n",
|
||||
(uintptr_t) old_buffer1 == (uintptr_t) buffer1 ?
|
||||
"same" : "different" );
|
||||
mbedtls_printf( " CALLOC(1 again): passed\n" );
|
||||
}
|
||||
|
||||
if( verbose )
|
||||
|
||||
Reference in New Issue
Block a user