This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit b74b8c2e1e2841e549b16f27884f444eae2184b4
Author: dengwenqi <[email protected]>
AuthorDate: Thu Oct 15 13:49:22 2026 +0800

    netutils/iperf: close the TCP client socket when connect() fails.
    
    iperf_tcp_client() returned -1 without closing sockfd, which leaked the
    descriptor and left the connection retransmitting SYNs in SYN_SENT.
    
    Signed-off-by: dengwenqi <[email protected]>
    Assisted-by: Kiro:claude-opus-4
---
 netutils/iperf/iperf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/netutils/iperf/iperf.c b/netutils/iperf/iperf.c
index 370caf23e..b16865290 100644
--- a/netutils/iperf/iperf.c
+++ b/netutils/iperf/iperf.c
@@ -905,6 +905,7 @@ static int iperf_tcp_client(FAR struct iperf_ctrl_t *ctrl,
   if (connect(sockfd, addr, addrlen) < 0)
     {
       iperf_show_socket_error_reason("tcp client connect", sockfd);
+      close(sockfd);
       return -1;
     }
 

Reply via email to