From: Daniel Wagner <daniel.wag...@bmw-carit.de>

When connect() fails we should close the socket.

Reported by coverty.
---
 tools/dnsproxy-test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/dnsproxy-test.c b/tools/dnsproxy-test.c
index 84602b6..8bb4878 100644
--- a/tools/dnsproxy-test.c
+++ b/tools/dnsproxy-test.c
@@ -146,6 +146,7 @@ static int connect_tcp_socket(char *server)
        LOG("sk %d family %d", sk, rp->ai_family);
 
        if (sk >= 0 && connect(sk, rp->ai_addr, rp->ai_addrlen) < 0) {
+               close(sk);
                err = -errno;
                fprintf(stderr, "Failed to connect to DNS server at %s "
                                "errno %d/%s\n",
-- 
1.8.4.474.g128a96c

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to