diff options
author | David Cantrell <dcantrell@redhat.com> | 2008-06-27 05:18:17 -1000 |
---|---|---|
committer | David Cantrell <dcantrell@redhat.com> | 2008-06-27 05:18:17 -1000 |
commit | 539fc605f9402830860bf2276f6b790bceef6fc6 (patch) | |
tree | 49863a7fde8eab8b7bbc8309cb957190284be002 /loader2/urls.c | |
parent | 83389b2effe828debfbbcbebf87dbfd2cc12e361 (diff) | |
download | anaconda-539fc605f9402830860bf2276f6b790bceef6fc6.tar.gz anaconda-539fc605f9402830860bf2276f6b790bceef6fc6.tar.xz anaconda-539fc605f9402830860bf2276f6b790bceef6fc6.zip |
Check return value of asprintf() consistently
For instances where the asprintf() was ignored, wrap it in
a test to check if it failed. If it failed, log a message
and abort. There may be some instances where abort may
not be what we want to do, however, we were ignoring the
return value completely so if we did get a failure, it would
just SIGSEGV. Now it will SIGABRT instead.
Diffstat (limited to 'loader2/urls.c')
-rw-r--r-- | loader2/urls.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/loader2/urls.c b/loader2/urls.c index 8dd81bc2a..1f9a55e62 100644 --- a/loader2/urls.c +++ b/loader2/urls.c @@ -277,7 +277,6 @@ int urlMainSetupPanel(struct iurlinfo * ui) { newtGrid buttons, grid; char * chptr; char * buf = NULL; - int r; /* Populate the UI with whatever initial value we've got. */ if (ui && ui->prefix) @@ -285,8 +284,14 @@ int urlMainSetupPanel(struct iurlinfo * ui) { buttons = newtButtonBar(_("OK"), &okay, _("Back"), &cancel, NULL); - r = asprintf(&buf, _("Please enter the URL containing the %s images on your server."), - getProductName()); + if (asprintf(&buf, + _("Please enter the URL containing the %s images on your server."), + getProductName()) == -1) { + logMessage(CRITICAL, "%s: %d: %s", __func__, __LINE__, + strerror(errno)); + abort(); + } + reflowedText = newtReflowText(buf, 47, 5, 5, &width, &height); free(buf); |