Don't leak sockets when getsockname fails.
diff --git a/src/dnsmasq.c b/src/dnsmasq.c
index 2ab1bda..00551a1 100644
--- a/src/dnsmasq.c
+++ b/src/dnsmasq.c
@@ -1345,10 +1345,15 @@
 
 	  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