mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-24 22:15:07 +00:00
Only do dynamic alloc when necessary
This commit is contained in:
parent
925a72628b
commit
56e245d959
|
@ -70,10 +70,14 @@ void debug_set_threshold( int threshold )
|
||||||
char *debug_fmt( const char *format, ... )
|
char *debug_fmt( const char *format, ... )
|
||||||
{
|
{
|
||||||
va_list argp;
|
va_list argp;
|
||||||
|
#if defined(POLARSSL_THREADING_C)
|
||||||
char *str = polarssl_malloc( DEBUG_BUF_SIZE );
|
char *str = polarssl_malloc( DEBUG_BUF_SIZE );
|
||||||
|
|
||||||
if( str == NULL )
|
if( str == NULL )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
#else
|
||||||
|
static char str[DEBUG_BUF_SIZE];
|
||||||
|
#endif
|
||||||
|
|
||||||
va_start( argp, format );
|
va_start( argp, format );
|
||||||
vsnprintf( str, DEBUG_BUF_SIZE - 1, format, argp );
|
vsnprintf( str, DEBUG_BUF_SIZE - 1, format, argp );
|
||||||
|
@ -89,7 +93,9 @@ void debug_print_msg_free( const ssl_context *ssl, int level,
|
||||||
if( text != NULL )
|
if( text != NULL )
|
||||||
debug_print_msg( ssl, level, file, line, text );
|
debug_print_msg( ssl, level, file, line, text );
|
||||||
|
|
||||||
|
#if defined(POLARSSL_THREADING_C)
|
||||||
polarssl_free( text );
|
polarssl_free( text );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void debug_print_msg( const ssl_context *ssl, int level,
|
void debug_print_msg( const ssl_context *ssl, int level,
|
||||||
|
|
Loading…
Reference in a new issue