Commit 46b06656 authored by Simon Kelley's avatar Simon Kelley

Don't leak sockets when getsockname fails.

parent 4dc9c657
...@@ -1345,10 +1345,15 @@ static void check_dns_listeners(fd_set *set, time_t now) ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment