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

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


The following commit(s) were added to refs/heads/master by this push:
     new 26e02700dd 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
26e02700dd is described below

commit 26e02700dd476e75787d9f0dadd979864c8cdafe
Author: nuttxs <zhaoqing.zh...@sony.com>
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 <zhaoqing.zh...@sony.com>
---
 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