* src/http.c (http_loop): Fix memory leak

This commit is contained in:
Tim Rühsen 2024-06-09 20:00:45 +02:00
parent 567e67afd2
commit 8775506f63

View File

@ -4244,19 +4244,19 @@ http_loop (const struct url *u, struct url *original_url, char **newloc,
struct stat st;
bool send_head_first = true;
bool force_full_retrieve = false;
bool return_local_file;
/* If we are writing to a WARC file: always retrieve the whole file. */
if (opt.warc_filename != NULL)
force_full_retrieve = true;
/* Assert that no value for *LOCAL_FILE was passed. */
assert (local_file == NULL || *local_file == NULL);
/* Set LOCAL_FILE parameter. */
if (local_file && opt.output_document)
*local_file = HYPHENP (opt.output_document) ? NULL : xstrdup (opt.output_document);
return_local_file = local_file && opt.output_document && !HYPHENP (opt.output_document);
// return_local_file = (local_file && opt.output_document && !HYPHENP (opt.output_document));
/* Reset NEWLOC parameter. */
*newloc = NULL;
@ -4871,7 +4871,6 @@ Remote file exists.\n\n"));
exit:
if ((ret == RETROK || opt.content_on_error) && local_file)
{
xfree (*local_file);
/* Bugfix: Prevent SIGSEGV when hstat.local_file was left NULL
(i.e. due to opt.content_disposition). */
if (hstat.local_file)