Fix compiler warnings

This commit is contained in:
Jarno Lamsa 2019-06-06 15:10:07 +03:00
parent 8a91c0650a
commit 034ae84601
2 changed files with 12 additions and 12 deletions

View file

@ -2367,13 +2367,13 @@ send_request:
#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
if( opt.serialize != 0 )
{
size_t len;
unsigned char *buf = NULL;
size_t buf_len;
unsigned char *context_buf = NULL;
opt.serialize = 0;
mbedtls_printf( " Serializing live connection..." );
ret = mbedtls_ssl_context_save( &ssl, NULL, 0, &len );
ret = mbedtls_ssl_context_save( &ssl, NULL, 0, &buf_len );
/* Allow stub implementation returning 0 for now */
if( ret != MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL &&
@ -2385,7 +2385,7 @@ send_request:
goto exit;
}
if( ( buf = mbedtls_calloc( 1, len ) ) == NULL )
if( ( context_buf = mbedtls_calloc( 1, buf_len ) ) == NULL )
{
mbedtls_printf( " failed\n ! Couldn't allocate buffer for "
"serialized context" );
@ -2393,7 +2393,7 @@ send_request:
goto exit;
}
if( ( ret = mbedtls_ssl_context_save( &ssl, buf, len, &len ) ) != 0 )
if( ( ret = mbedtls_ssl_context_save( &ssl, context_buf, buf_len, &buf_len ) ) != 0 )
{
mbedtls_printf( "failed\n ! mbedtls_ssl_context_save returned "
"-0x%x\n\n", -ret );
@ -2425,7 +2425,7 @@ send_request:
mbedtls_printf( " Deserializing connection..." );
if( ( ret = mbedtls_ssl_context_load( &ssl, buf, len ) ) != 0 )
if( ( ret = mbedtls_ssl_context_load( &ssl, context_buf, buf_len ) ) != 0 )
{
mbedtls_printf( "failed\n ! mbedtls_ssl_context_load returned "
"-0x%x\n\n", -ret );

View file

@ -3352,13 +3352,13 @@ data_exchange:
#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
if( opt.serialize != 0 )
{
size_t len;
unsigned char *buf = NULL;
size_t buf_len;
unsigned char *context_buf = NULL;
opt.serialize = 0;
mbedtls_printf( " Serializing live connection..." );
ret = mbedtls_ssl_context_save( &ssl, NULL, 0, &len );
ret = mbedtls_ssl_context_save( &ssl, NULL, 0, &buf_len );
/* Allow stub implementation returning 0 for now */
if( ret != MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL &&
@ -3370,7 +3370,7 @@ data_exchange:
goto exit;
}
if( ( buf = mbedtls_calloc( 1, len ) ) == NULL )
if( ( context_buf = mbedtls_calloc( 1, buf_len ) ) == NULL )
{
mbedtls_printf( " failed\n ! Couldn't allocate buffer for "
"serialized context" );
@ -3378,7 +3378,7 @@ data_exchange:
goto exit;
}
if( ( ret = mbedtls_ssl_context_save( &ssl, buf, len, &len ) ) != 0 )
if( ( ret = mbedtls_ssl_context_save( &ssl, context_buf, buf_len, &buf_len ) ) != 0 )
{
mbedtls_printf( "failed\n ! mbedtls_ssl_context_save returned "
"-0x%x\n\n", -ret );
@ -3409,7 +3409,7 @@ data_exchange:
mbedtls_printf( " Deserializing connection..." );
if( ( ret = mbedtls_ssl_context_load( &ssl, buf, len ) ) != 0 )
if( ( ret = mbedtls_ssl_context_load( &ssl, context_buf, buf_len ) ) != 0 )
{
mbedtls_printf( "failed\n ! mbedtls_ssl_context_load returned "
"-0x%x\n\n", -ret );