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

acassis pushed a commit to branch releases/12.10
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/releases/12.10 by this push:
     new a741cd3975 netdb/lib_dnsquery.c: In the IPv6 or IPv4 
dns_query_callback() block, if dns_recv_response() fails, dns_bind() is called 
again at try_stream to create a new socket. However, the original socket 
descriptor sd isn't closed
a741cd3975 is described below

commit a741cd3975e8cb1e176cb111f0f3dde606cff293
Author: nuttxs <[email protected]>
AuthorDate: Mon Jun 23 17:55:44 2025 +0800

    netdb/lib_dnsquery.c: In the IPv6 or IPv4 dns_query_callback() block, if 
dns_recv_response() fails, dns_bind() is called again at try_stream to create a 
new socket. However, the original socket descriptor sd isn't closed
    
    Signed-off-by: nuttxs <[email protected]>
---
 libs/libc/netdb/lib_dnsquery.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libs/libc/netdb/lib_dnsquery.c b/libs/libc/netdb/lib_dnsquery.c
index 670fae69e1..f7bb8e0a4a 100644
--- a/libs/libc/netdb/lib_dnsquery.c
+++ b/libs/libc/netdb/lib_dnsquery.c
@@ -902,6 +902,7 @@ try_stream:
                 {
                   if (!stream && should_try_stream)
                     {
+                      close(sd);  /* Close current socket before trying stream 
mode */
                       stream = true;
                       goto try_stream; /* Don't consume retry count */
                     }
@@ -961,6 +962,7 @@ try_stream:
                 {
                   if (!stream && should_try_stream)
                     {
+                      close(sd);  /* Close current socket before trying stream 
mode */
                       stream = true;
                       goto try_stream; /* Don't consume retry count */
                     }

Reply via email to