/* Convert message to string */
#if defined(HAVE_VASPRINTF) && !defined(__APPLE__) && !defined( SYS_BEOS )
vlc_va_copy( args, _args );
- vasprintf( &psz_str, psz_format, args );
+ if( vasprintf( &psz_str, psz_format, args ) == -1 )
+ psz_str = NULL;
va_end( args );
#else
psz_str = (char*) malloc( i_size );
va_list ap;
msg_context_t *p_ctx = GetContext();
assert( p_ctx );
+
va_start( ap, psz_message );
- if( p_ctx->psz_message != NULL )
- {
- free( p_ctx->psz_message );
- }
+ free( p_ctx->psz_message );
- vasprintf( &p_ctx->psz_message, psz_message, ap );
+ if( vasprintf( &p_ctx->psz_message, psz_message, ap ) == -1 )
+ p_ctx->psz_message = NULL;
va_end( ap );
+
p_ctx->i_code = i_code;
}
assert( p_ctx );
va_start( ap, psz_message );
- vasprintf( &psz_tmp, psz_message, ap );
+ if( vasprintf( &psz_tmp, psz_message, ap ) == -1 )
+ psz_tmp = NULL;
va_end( ap );
if( !p_ctx->psz_message )