Skip to content

Commit

Permalink
iperf_tcp: Fix two potential memory leaks in iperf_tcp_connect()
Browse files Browse the repository at this point in the history
The descriptor `s` and pointer `server_res` are lost without close and free.

Signed-off-by: Maks Mishin <[email protected]>
  • Loading branch information
maks-mishin committed Jan 16, 2025
1 parent 352ef1b commit fbfc580
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/iperf_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@ iperf_tcp_connect(struct iperf_test *test)
printf("SNDBUF is %u, expecting %u\n", sndbuf_actual, test->settings->socket_bufsize);
}
if (test->settings->socket_bufsize && test->settings->socket_bufsize > sndbuf_actual) {
close(s);
freeaddrinfo(server_res);
i_errno = IESETBUF2;
return -1;
}
Expand Down

0 comments on commit fbfc580

Please sign in to comment.