mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Fix obvious memory leaks in the VMS directory parser.
Published in <sxsadwqpbo1.fsf@florida.arsdigita.de>.
This commit is contained in:
parent
f029b04f39
commit
b8789d7798
@ -1,3 +1,7 @@
|
|||||||
|
2001-12-11 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||||
|
|
||||||
|
* ftp-ls.c (ftp_parse_vms_ls): Fix obvious memory leaks.
|
||||||
|
|
||||||
2001-12-10 Hrvoje Niksic <hniksic@arsdigita.com>
|
2001-12-10 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||||
|
|
||||||
* main.c (main): Initialize progress after fork_to_background, so
|
* main.c (main): Initialize progress after fork_to_background, so
|
||||||
|
31
src/ftp-ls.c
31
src/ftp-ls.c
@ -577,23 +577,31 @@ ftp_parse_vms_ls (const char *file)
|
|||||||
}
|
}
|
||||||
dir = l = NULL;
|
dir = l = NULL;
|
||||||
|
|
||||||
/* #### The next three lines are a memory leak because they don't
|
/* Skip empty line. */
|
||||||
bother to free the pointer that read_whole_line() returns!
|
line = read_whole_line (fp);
|
||||||
FIXME! */
|
if (line)
|
||||||
|
xfree (line);
|
||||||
|
|
||||||
/* Empty line */
|
/* Skip "Directory PUB$DEVICE[PUB]" */
|
||||||
read_whole_line (fp);
|
line = read_whole_line (fp);
|
||||||
/* "Directory PUB$DEVICE[PUB]" */
|
if (line)
|
||||||
read_whole_line (fp);
|
xfree (line);
|
||||||
/* Empty line */
|
|
||||||
read_whole_line (fp);
|
/* Skip empty line. */
|
||||||
|
line = read_whole_line (fp);
|
||||||
|
if (line)
|
||||||
|
xfree (line);
|
||||||
|
|
||||||
/* Line loop to end of file: */
|
/* Line loop to end of file: */
|
||||||
while ((line = read_whole_line (fp)))
|
while ((line = read_whole_line (fp)))
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
i = clean_line (line);
|
i = clean_line (line);
|
||||||
if (!i) break;
|
if (!i)
|
||||||
|
{
|
||||||
|
xfree (line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* First column: Name. A bit of black magic again. The name my be
|
/* First column: Name. A bit of black magic again. The name my be
|
||||||
either ABCD.EXT or ABCD.EXT;NUM and it might be on a separate
|
either ABCD.EXT or ABCD.EXT;NUM and it might be on a separate
|
||||||
@ -650,6 +658,7 @@ ftp_parse_vms_ls (const char *file)
|
|||||||
if (!i)
|
if (!i)
|
||||||
{
|
{
|
||||||
DEBUGP(("confusing VMS listing item, leaving listing parser\n"));
|
DEBUGP(("confusing VMS listing item, leaving listing parser\n"));
|
||||||
|
xfree (line);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tok = strtok(line, " ");
|
tok = strtok(line, " ");
|
||||||
@ -669,6 +678,7 @@ ftp_parse_vms_ls (const char *file)
|
|||||||
the first strtok(NULL, "-") will return everything until the end
|
the first strtok(NULL, "-") will return everything until the end
|
||||||
of the line and only the next strtok() call will return NULL. */
|
of the line and only the next strtok() call will return NULL. */
|
||||||
DEBUGP(("nonsense in VMS listing, skipping this line\n"));
|
DEBUGP(("nonsense in VMS listing, skipping this line\n"));
|
||||||
|
xfree (line);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (i=0; i<12; i++) if (!strcmp(tok,months[i])) break;
|
for (i=0; i<12; i++) if (!strcmp(tok,months[i])) break;
|
||||||
@ -718,6 +728,7 @@ ftp_parse_vms_ls (const char *file)
|
|||||||
if (tok == NULL)
|
if (tok == NULL)
|
||||||
{
|
{
|
||||||
DEBUGP(("confusing VMS permissions, skipping line\n"));
|
DEBUGP(("confusing VMS permissions, skipping line\n"));
|
||||||
|
xfree (line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* Permissons have the format "RWED,RWED,RE" */
|
/* Permissons have the format "RWED,RWED,RE" */
|
||||||
|
Loading…
Reference in New Issue
Block a user