nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

netdb/lib_dnsquery.c: prevent file descriptor leakage

Open nuttxs opened this issue 6 months ago • 0 comments

Summary

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.

Impact

New Feature/Change: Issue fix (no new feature). User Impact: Prevent file descriptor leakage. Build Impact:No new Kconfig options or build system changes. Hardware Impact: No Security: No Compatibility: Backward-compatible; no breaking changes.

Testing

When DNS query fails and a switch from UDP to TCP streaming mode is required, UDP connections will continue to increase as follows: 图片 Afer fix, UDP connections do not increase like before.

nuttxs avatar Jun 23 '25 10:06 nuttxs