mirror of
https://github.com/mirror/wget.git
synced 2025-03-25 01:00:13 +08:00
* src/ftp.c (ftp_retrieve_dirs): Remove use of alloca
This commit is contained in:
parent
94bae4dd18
commit
a274740598
17
src/ftp.c
17
src/ftp.c
@ -2482,8 +2482,9 @@ static uerr_t
|
||||
ftp_retrieve_dirs (struct url *u, struct url *original_url,
|
||||
struct fileinfo *f, ccon *con)
|
||||
{
|
||||
char *container = NULL;
|
||||
int container_size = 0;
|
||||
char buf[1024];
|
||||
char *container = buf;
|
||||
int container_size = sizeof (buf);
|
||||
|
||||
for (; f; f = f->next)
|
||||
{
|
||||
@ -2500,7 +2501,14 @@ ftp_retrieve_dirs (struct url *u, struct url *original_url,
|
||||
item on the bottom of the stack. */
|
||||
size = strlen (u->dir) + 1 + strlen (f->name) + 1;
|
||||
if (size > container_size)
|
||||
container = (char *)alloca (size);
|
||||
{
|
||||
if (container == buf)
|
||||
container = xmalloc (size);
|
||||
else
|
||||
container = xrealloc (container, size);
|
||||
|
||||
container_size = size;
|
||||
}
|
||||
newdir = container;
|
||||
|
||||
odir = u->dir;
|
||||
@ -2537,6 +2545,9 @@ Not descending to %s as it is excluded/not-included.\n"),
|
||||
/* Set the time-stamp? */
|
||||
}
|
||||
|
||||
if (container != buf)
|
||||
xfree (container);
|
||||
|
||||
if (opt.quota && total_downloaded_bytes > opt.quota)
|
||||
return QUOTEXC;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user