Skip to content

Commit

Permalink
Fix descriptor leak in some return paths
Browse files Browse the repository at this point in the history
  • Loading branch information
maks-mishin authored and bmah888 committed Mar 21, 2024
1 parent 111212b commit ed7d16c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/iperf_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ iperf_tcp_listen(struct iperf_test *test)

if (listen(s, INT_MAX) < 0) {
i_errno = IESTREAMLISTEN;
close(s);
return -1;
}

Expand All @@ -331,6 +332,7 @@ iperf_tcp_listen(struct iperf_test *test)
}
if (test->settings->socket_bufsize && test->settings->socket_bufsize > sndbuf_actual) {
i_errno = IESETBUF2;
close(s);
return -1;
}

Expand All @@ -348,6 +350,7 @@ iperf_tcp_listen(struct iperf_test *test)
}
if (test->settings->socket_bufsize && test->settings->socket_bufsize > rcvbuf_actual) {
i_errno = IESETBUF2;
close(s);
return -1;
}

Expand Down

0 comments on commit ed7d16c

Please sign in to comment.