From f50f74034f3340cace25b2b553564e306305415e Mon Sep 17 00:00:00 2001 From: wangxiaomeng Date: Tue, 19 Nov 2024 14:49:22 +0800 Subject: [PATCH] Relocate patches from upstream communities to fix memory leak for parallel tests --- ...t-Fix-memory-leak-for-parallel-tests.patch | 29 +++++++++++++++++++ iperf3.spec | 6 +++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 backport-Fix-memory-leak-for-parallel-tests.patch diff --git a/backport-Fix-memory-leak-for-parallel-tests.patch b/backport-Fix-memory-leak-for-parallel-tests.patch new file mode 100644 index 0000000..614e764 --- /dev/null +++ b/backport-Fix-memory-leak-for-parallel-tests.patch @@ -0,0 +1,29 @@ +From 8b39c84a38f9c0c75f783408a4ed47687ccc581c Mon Sep 17 00:00:00 2001 +From: Matthew Cather <14895427+MattCatz@users.noreply.github.com> +Date: Fri, 7 Jun 2024 14:48:00 -0500 +Subject: [PATCH] Fix memory leak for parallel tests + +`congestion_used` is set each iteration of the loop. For tests running parallel streams, the previous malloc-ed string (from `strdup`) is leaked. +--- + src/iperf_client_api.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c +index 7ad4c93..a552fd6 100644 +--- a/src/iperf_client_api.c ++++ b/src/iperf_client_api.c +@@ -130,6 +130,11 @@ iperf_create_streams(struct iperf_test *test, int sender) + i_errno = IESETCONGESTION; + return -1; + } ++ if (test->congestion_used) { ++ if (test->debug) ++ printf("Overriding existing congestion algorithm: %s\n", test->congestion_used); ++ free(test->congestion_used); ++ } + // Set actual used congestion alg, or set to unknown if could not get it + if (rc < 0) + test->congestion_used = strdup("unknown"); +-- +2.33.0 + diff --git a/iperf3.spec b/iperf3.spec index 8c4be0a..f75d01d 100644 --- a/iperf3.spec +++ b/iperf3.spec @@ -1,6 +1,6 @@ Name: iperf3 Version: 3.17.1 -Release: 4 +Release: 5 Summary: TCP,UDP,and SCTP network bandwidth measurement tool License: BSD URL: http://github.com/esnet/iperf @@ -9,6 +9,7 @@ Source0: https://github.com/esnet/iperf/archive/%{version}/iperf-%{versio Patch0001: backport-Avoid-duplicate-thread-recycling.patch Patch0002: backport-Remove-incorrect-freeaddrinfo-call.patch Patch0003: backport-Performance-enhancement-for-iperf_time_add.patch +Patch0004: backport-Fix-memory-leak-for-parallel-tests.patch BuildRequires: libuuid-devel gcc lksctp-tools-devel Requires: lksctp-tools @@ -59,6 +60,9 @@ mkdir -p %{buildroot}%{_mandir}/man1 %{_mandir}/man3/libiperf.3.gz %changelog +* Tue Nov 19 2024 wangxiaomeng - 3.17.1-5 +- Relocate patches from upstream communities to fix memory leak for parallel tests + * Sun Sep 29 2024 jiangjixiang - 3.17.1-4 - Relocate patches from upstream communities to performance enhancement for iperf_time_add(). -- Gitee