Skip to content

Commit

Permalink
Fix memory leak for parallel tests
Browse files Browse the repository at this point in the history
`congestion_used` is set each iteration of the loop. For tests running parallel streams, the previous malloc-ed string (from `strdup`) is leaked.
  • Loading branch information
MattCatz authored Jun 7, 2024
1 parent 8f5a87e commit 8b39c84
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/iperf_client_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 8b39c84

Please sign in to comment.