summaryrefslogtreecommitdiff
path: root/argp
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-06-01 22:15:24 +0000
committerUlrich Drepper <drepper@redhat.com>2004-06-01 22:15:24 +0000
commit9ddfc0595a4444ee13aec46e118b3b3463012267 (patch)
tree64335caf02b59e9c4d27a6195cb24c630903f9e1 /argp
parent7a7fc6396cc9d112a3609b341b08b7b200f2bac5 (diff)
downloadglibc-9ddfc0595a4444ee13aec46e118b3b3463012267.tar.gz
(__argp_error, __argp_failure): Check result of __asprintf call and don't use string if it failed.
Diffstat (limited to 'argp')
-rw-r--r--argp/argp-help.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/argp/argp-help.c b/argp/argp-help.c
index 1921e5258e..67018709d3 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -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);