From 8775506f632f14404e4755dbae679dea07abf12a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Sun, 9 Jun 2024 20:00:45 +0200 Subject: [PATCH] * src/http.c (http_loop): Fix memory leak --- src/http.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/http.c b/src/http.c index 16edf461..0ff4572a 100644 --- a/src/http.c +++ b/src/http.c @@ -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)