mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-20 02:38:32 +00:00
Don't leak sockets when getsockname fails.
This commit is contained in:
@@ -1345,10 +1345,15 @@ static void check_dns_listeners(fd_set *set, time_t now)
|
|||||||
|
|
||||||
while ((confd = accept(listener->tcpfd, NULL, NULL)) == -1 && errno == EINTR);
|
while ((confd = accept(listener->tcpfd, NULL, NULL)) == -1 && errno == EINTR);
|
||||||
|
|
||||||
if (confd == -1 ||
|
if (confd == -1)
|
||||||
getsockname(confd, (struct sockaddr *)&tcp_addr, &tcp_len) == -1)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (getsockname(confd, (struct sockaddr *)&tcp_addr, &tcp_len) == -1)
|
||||||
|
{
|
||||||
|
close(confd);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (option_bool(OPT_NOWILD))
|
if (option_bool(OPT_NOWILD))
|
||||||
iface = listener->iface; /* May be NULL */
|
iface = listener->iface; /* May be NULL */
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user