nuttx
nuttx copied to clipboard
netdb/lib_dnsquery.c: prevent file descriptor leakage
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.