mirror of
https://github.com/mirror/wget.git
synced 2025-03-04 23:00:22 +08:00
* src/ftp-ls.c (ftp_parse_winnt_ls): Fix memleak
This commit is contained in:
parent
f0d715b264
commit
2b61c46183
@ -423,6 +423,7 @@ ftp_parse_winnt_ls (FILE *fp)
|
||||
struct fileinfo *dir, *l, cur; /* list creation */
|
||||
|
||||
dir = l = NULL;
|
||||
cur.name = NULL;
|
||||
|
||||
/* Line loop to end of file: */
|
||||
while ((len = getline (&line, &bufsize, fp)) > 0)
|
||||
@ -461,6 +462,7 @@ ftp_parse_winnt_ls (FILE *fp)
|
||||
}
|
||||
/* Now it is possible to determine the position of the first symbol in
|
||||
filename. */
|
||||
xfree (cur.name);
|
||||
memset(&cur, 0, sizeof (cur));
|
||||
cur.name = xstrdup(filename);
|
||||
DEBUGP (("Name: '%s'\n", cur.name));
|
||||
@ -544,8 +546,10 @@ ftp_parse_winnt_ls (FILE *fp)
|
||||
memcpy (l, &cur, sizeof (cur));
|
||||
l->next = NULL;
|
||||
}
|
||||
cur.name = NULL;
|
||||
}
|
||||
|
||||
xfree (cur.name);
|
||||
xfree (line);
|
||||
return dir;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user