(__argp_error, __argp_failure): Check result of __asprintf call and don't use string if it failed.

This commit is contained in:
Ulrich Drepper 2004-06-01 22:15:24 +00:00
parent 7a7fc6396c
commit 9ddfc0595a
1 changed files with 4 additions and 2 deletions

View File

@ -1768,7 +1768,8 @@ __argp_error (const struct argp_state *state, const char *fmt, ...)
{
char *buf;
__asprintf (&buf, fmt, ap);
if (__asprintf (&buf, fmt, ap) < 0)
buf = NULL;
__fwprintf (stream, L"%s: %s\n",
state ? state->name : __argp_short_program_name (),
@ -1846,7 +1847,8 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
{
char *buf;
__asprintf (&buf, fmt, ap);
if (__asprintf (&buf, fmt, ap) < 0)
buf = NULL;
__fwprintf (stream, L": %s", buf);