From 26e02700dd476e75787d9f0dadd979864c8cdafe Mon Sep 17 00:00:00 2001 From: nuttxs Date: Mon, 23 Jun 2025 17:55:44 +0800 Subject: [PATCH] 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 --- 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 */ }