aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaks Mishin <maks.mishinFZ@gmail.com>2023-12-15 00:13:48 +0300
committerBruce A. Mah <bmah@kitchenlab.org>2024-03-21 19:40:12 -0400
commited7d16c33edaaabca0fc1746dfc448a3a147174e (patch)
treed39ee8db0458cec7b6f5cdda1d1771c8e009cdf6
parent111212bca2eaab948cff11fafddcb097e7615f52 (diff)
downloadiperf3-ed7d16c33edaaabca0fc1746dfc448a3a147174e.tar.gz
Fix descriptor leak in some return paths
-rw-r--r--src/iperf_tcp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/iperf_tcp.c b/src/iperf_tcp.c
index 9217e7f..71c40a6 100644
--- a/src/iperf_tcp.c
+++ b/src/iperf_tcp.c
@@ -311,6 +311,7 @@ iperf_tcp_listen(struct iperf_test *test)
if (listen(s, INT_MAX) < 0) {
i_errno = IESTREAMLISTEN;
+ close(s);
return -1;
}
@@ -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;
}
@@ -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;
}