已开启
src/http.c (http_loop): Fix memory leak #39
baiguoguo创建于 2024年7月3日
src/http.c (http_loop): Fix memory leak #39
已开启
baiguoguo创建于 2024年7月3日
从refs/pull/39/head合入到master
共 2 个文件变更+52-1
@@ -0,0 +1,44 @@
1+From 8775506f632f14404e4755dbae679dea07abf12a Mon Sep 17 00:00:00 2001
2+From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
3+Date: Sun, 9 Jun 2024 20:00:45 +0200
4+Subject: * src/http.c (http_loop): Fix memory leak
5+Reference: https://git.savannah.gnu.org/cgit/wget.git/commit/?id=8775506f632f14404e4755dbae679dea07abf12a
6+ 
7+---
8+ src/http.c | 6 ++----
9+ 1 file changed, 2 insertions(+), 4 deletions(-)
10+ 
11+diff --git a/src/http.c b/src/http.c
12+index 116a93a..4e4d141 100644
13+--- a/src/http.c
14++++ b/src/http.c
15+@@ -4241,7 +4241,7 @@ http_loop (const struct url *u, struct url *original_url, char **newloc,
16+ bool send_head_first = true;
17+ bool force_full_retrieve = false;
18+
19+-
20++ bool return_local_file;
21+ /* If we are writing to a WARC file: always retrieve the whole file. */
22+ if (opt.warc_filename != NULL)
23+ force_full_retrieve = true;
24+@@ -4251,8 +4251,7 @@ http_loop (const struct url *u, struct url *original_url, char **newloc,
25+ assert (local_file == NULL || *local_file == NULL);
26+
27+ /* Set LOCAL_FILE parameter. */
28+- if (local_file && opt.output_document)
29+- *local_file = HYPHENP (opt.output_document) ? NULL : xstrdup (opt.output_document);
30++ return_local_file = local_file && opt.output_document && !HYPHENP (opt.output_document);
31+
32+ /* Reset NEWLOC parameter. */
33+ *newloc = NULL;
34+@@ -4866,7 +4865,6 @@ Remote file exists.\n\n"));
35+ exit:
36+ if ((ret == RETROK || opt.content_on_error) && local_file)
37+ {
38+- xfree (*local_file);
39+ /* Bugfix: Prevent SIGSEGV when hstat.local_file was left NULL
40+ (i.e. due to opt.content_disposition). */
41+ if (hstat.local_file)
42+--
43+2.27.0
44+ 
@@ -1,6 +1,6 @@
1Name: wget1Name: wget
2Version: 1.21.42Version: 1.21.4
3-Release: 23+Release: 3
4Summary: A package for retrieving files using HTTP, HTTPS, FTP and FTPS the most widely-used Internet protocols.4Summary: A package for retrieving files using HTTP, HTTPS, FTP and FTPS the most widely-used Internet protocols.
5License: GPL-3.0-or-later AND LGPL-2.1-or-later5License: GPL-3.0-or-later AND LGPL-2.1-or-later
6Url: http://www.gnu.org/software/wget/6Url: http://www.gnu.org/software/wget/
@@ -8,6 +8,7 @@ Source: https://ftp.gnu.org/gnu/wget/wget-%{version}.tar.gz
8 8 
9Patch0: backport-wget-1.17-path.patch9Patch0: backport-wget-1.17-path.patch
10Patch1: backport-CVE-2024-38428.patch10Patch1: backport-CVE-2024-38428.patch
11+Patch2: backport-src-http.c-http_loop-Fix-memory-leak.patch
11 12 
12Provides: webclient bundled(gnulib)13Provides: webclient bundled(gnulib)
13BuildRequires: make perl-HTTP-Daemon python3 libuuid-devel perl-podlators libpsl-devel libmetalink-devel14BuildRequires: make perl-HTTP-Daemon python3 libuuid-devel perl-podlators libpsl-devel libmetalink-devel
@@ -55,6 +56,12 @@ make check
55%{_infodir}/*56%{_infodir}/*
56 57 
57%changelog58%changelog
59+* Wed Jul 3 2024 baiguo <baiguo@kylinos.cn> -1.21.4-3
60+- Type:bugfix
61+- ID:NA
62+- SUG:NA
63+- DESC:src/http.c (http_loop): Fix memory leak
64+ 
58* Sun Jun 16 2024 xuchenchen <xuchenchen@kylinos.cn> -1.21.4-265* Sun Jun 16 2024 xuchenchen <xuchenchen@kylinos.cn> -1.21.4-2
59- Type:CVES66- Type:CVES
60- ID:NA67- ID:NA