mirror of
https://github.com/mirror/wget.git
synced 2025-03-05 23:30:35 +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 */
|
struct fileinfo *dir, *l, cur; /* list creation */
|
||||||
|
|
||||||
dir = l = NULL;
|
dir = l = NULL;
|
||||||
|
cur.name = NULL;
|
||||||
|
|
||||||
/* Line loop to end of file: */
|
/* Line loop to end of file: */
|
||||||
while ((len = getline (&line, &bufsize, fp)) > 0)
|
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
|
/* Now it is possible to determine the position of the first symbol in
|
||||||
filename. */
|
filename. */
|
||||||
|
xfree (cur.name);
|
||||||
memset(&cur, 0, sizeof (cur));
|
memset(&cur, 0, sizeof (cur));
|
||||||
cur.name = xstrdup(filename);
|
cur.name = xstrdup(filename);
|
||||||
DEBUGP (("Name: '%s'\n", cur.name));
|
DEBUGP (("Name: '%s'\n", cur.name));
|
||||||
@ -544,8 +546,10 @@ ftp_parse_winnt_ls (FILE *fp)
|
|||||||
memcpy (l, &cur, sizeof (cur));
|
memcpy (l, &cur, sizeof (cur));
|
||||||
l->next = NULL;
|
l->next = NULL;
|
||||||
}
|
}
|
||||||
|
cur.name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xfree (cur.name);
|
||||||
xfree (line);
|
xfree (line);
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user