1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Fix memory leak in retrieve_from_file.

This commit is contained in:
Steven Schubiger 2010-03-02 20:35:02 +01:00
parent ec6950f1a6
commit f391a5b5b0
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2010-03-02 Steven Schubiger <stsc@member.fsf.org>
* retr.c (retrieve_from_file): Free memory of input file.
2010-03-01 Steven Schubiger <stsc@member.fsf.org>
* retr.c (retrieve_url): Retrieve the local filename from ftp_loop.

View File

@ -889,7 +889,7 @@ retrieve_from_file (const char *file, bool html, int *count)
struct urlpos *url_list, *cur_url;
struct iri *iri = iri_new();
char *input_file = NULL;
char *input_file, *url_file = NULL;
const char *url = file;
status = RETROK; /* Suppose everything is OK. */
@ -916,11 +916,11 @@ retrieve_from_file (const char *file, bool html, int *count)
if (!opt.base_href)
opt.base_href = xstrdup (url);
status = retrieve_url (url_parsed, url, &input_file, NULL, NULL, &dt,
status = retrieve_url (url_parsed, url, &url_file, NULL, NULL, &dt,
false, iri, true);
url_free (url_parsed);
if (!input_file || (status != RETROK))
if (!url_file || (status != RETROK))
return status;
if (dt & TEXTHTML)
@ -935,6 +935,8 @@ retrieve_from_file (const char *file, bool html, int *count)
iri->utf8_encode = opt.enable_iri;
xfree_null (iri->orig_url);
iri->orig_url = NULL;
input_file = url_file;
}
else
input_file = (char *) file;
@ -942,6 +944,8 @@ retrieve_from_file (const char *file, bool html, int *count)
url_list = (html ? get_urls_html (input_file, NULL, NULL, iri)
: get_urls_file (input_file));
xfree_null (url_file);
for (cur_url = url_list; cur_url; cur_url = cur_url->next, ++*count)
{
char *filename = NULL, *new_file = NULL;