mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Handle correctly some malloc failures.
This commit is contained in:
parent
611a219fb0
commit
bcc2abf116
@ -1,5 +1,7 @@
|
|||||||
2012-02-23 Giuseppe Scrivano <giuseppe@southpole.se>
|
2012-02-23 Giuseppe Scrivano <giuseppe@southpole.se>
|
||||||
|
|
||||||
|
* main.c (main): Fail gracefully if `malloc' fails.
|
||||||
|
|
||||||
* gnutls.c (wgnutls_read): Remove unused variables `timer' and `flags'.
|
* gnutls.c (wgnutls_read): Remove unused variables `timer' and `flags'.
|
||||||
|
|
||||||
2012-02-17 Steven Schubiger <stsc@member.fsf.org>
|
2012-02-17 Steven Schubiger <stsc@member.fsf.org>
|
||||||
|
10
src/main.c
10
src/main.c
@ -988,6 +988,11 @@ main (int argc, char **argv)
|
|||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
argstring_length += strlen (argv[i]) + 2 + 1;
|
argstring_length += strlen (argv[i]) + 2 + 1;
|
||||||
char *p = program_argstring = malloc (argstring_length * sizeof (char));
|
char *p = program_argstring = malloc (argstring_length * sizeof (char));
|
||||||
|
if (p == NULL)
|
||||||
|
{
|
||||||
|
fprintf (stderr, _("Memory allocation problem\n"));
|
||||||
|
exit (2);
|
||||||
|
}
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
*p++ = '"';
|
*p++ = '"';
|
||||||
@ -1355,6 +1360,11 @@ for details.\n\n"));
|
|||||||
|
|
||||||
/* Fill in the arguments. */
|
/* Fill in the arguments. */
|
||||||
url = alloca_array (char *, nurl + 1);
|
url = alloca_array (char *, nurl + 1);
|
||||||
|
if (url == NULL)
|
||||||
|
{
|
||||||
|
fprintf (stderr, _("Memory allocation problem\n"));
|
||||||
|
exit (2);
|
||||||
|
}
|
||||||
for (i = 0; i < nurl; i++, optind++)
|
for (i = 0; i < nurl; i++, optind++)
|
||||||
{
|
{
|
||||||
char *rewritten = rewrite_shorthand_url (argv[optind]);
|
char *rewritten = rewrite_shorthand_url (argv[optind]);
|
||||||
|
Loading…
Reference in New Issue
Block a user