Commit 7793bdcb authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Simplification

parent b855dc8d
...@@ -650,14 +650,13 @@ void msg_StackAdd( const char *psz_message, ... ) ...@@ -650,14 +650,13 @@ void msg_StackAdd( const char *psz_message, ... )
p_ctx->psz_message = psz_tmp; p_ctx->psz_message = psz_tmp;
else else
{ {
char *psz_old = malloc( strlen( p_ctx->psz_message ) + 1 ); char *psz_new;
memcpy( psz_old, p_ctx->psz_message, strlen( p_ctx->psz_message ) + 1 ); if( asprintf( &psz_new, "%s: %s", psz_tmp, p_ctx->psz_message ) == -1 )
p_ctx->psz_message = realloc( p_ctx->psz_message, psz_new = NULL;
strlen( p_ctx->psz_message ) +
/* ':', ' ', '0' */ free( p_ctx->psz_message );
strlen( psz_tmp ) + 3 ); p_ctx->psz_message = psz_new;
sprintf( p_ctx->psz_message, "%s: %s", psz_tmp, psz_old ); free( psz_tmp );
free( psz_tmp ); free( psz_old );
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment