Don't leak sockets when getsockname fails.

This commit is contained in:
Simon Kelley committed 2013-02-04 21:47:59 +00:00
1 parent 4dc9c657ad
commit 46b066565e
1 file changed
+7 -2
+7 -2
View File
@@ -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);
if (confd == -1 ||
getsockname(confd, (struct sockaddr *)&tcp_addr, &tcp_len) == -1)
if (confd == -1)
continue;
if (getsockname(confd, (struct sockaddr *)&tcp_addr, &tcp_len) == -1)
{
close(confd);
continue;
}
if (option_bool(OPT_NOWILD))
iface = listener->iface; /* May be NULL */
else