On 12.11.2013 15:46, Daniel Wagner wrote:
From: Daniel Wagner <[email protected]>

When connect() fails we should close the socket.

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

diff --git a/tools/dnsproxy-test.c b/tools/dnsproxy-test.c
index 84602b6..2830577 100644
--- a/tools/dnsproxy-test.c
+++ b/tools/dnsproxy-test.c
@@ -147,6 +147,7 @@ static int connect_tcp_socket(char *server)

        if (sk >= 0 && connect(sk, rp->ai_addr, rp->ai_addrlen) < 0) {
                err = -errno;
+               close(sk);
                fprintf(stderr, "Failed to connect to DNS server at %s "
                                "errno %d/%s\n",
                        server, -err, strerror(-err));


This fix introduces a new bug. The close needs to be after the fcntl().


_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to