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 1/2] 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 7ad4c939b..a552fd68d 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"); From 8a62bb75b03f0f5329b09822073f9b5f588fb524 Mon Sep 17 00:00:00 2001 From: Matthew Cather <14895427+MattCatz@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:25:29 -0500 Subject: [PATCH 2/2] Fix memory leak in `iperf_print_results` --- src/iperf_api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/iperf_api.c b/src/iperf_api.c index 4c73e8328..c96efdf0e 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -4200,6 +4200,7 @@ iperf_print_results(struct iperf_test *test) } if (test->server_output_text) { iperf_printf(test, "\nServer output:\n%s\n", test->server_output_text); + free(test->server_output_text); test->server_output_text = NULL; } }