Missing close(sock)
authorJagger <robert@swiecki.net>
Thu, 3 Mar 2016 22:41:10 +0000 (23:41 +0100)
committerJagger <robert@swiecki.net>
Thu, 3 Mar 2016 22:41:10 +0000 (23:41 +0100)
net.c

diff --git a/net.c b/net.c
index fcef388d864e1e8c1036a7bbc6e632869f78ab85..2719f2e2e9115cd9d3ba4e8994933e6a7d00299e 100644 (file)
--- a/net.c
+++ b/net.c
@@ -360,6 +360,7 @@ static bool netConfigureVs(struct nsjconf_t *nsjconf)
        int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
        if (sock == -1) {
                PLOG_E("socket(AF_INET, SOCK_STREAM, IPPROTO_IP)");
+               close(sock);
                return false;
        }
 
@@ -370,6 +371,7 @@ static bool netConfigureVs(struct nsjconf_t *nsjconf)
        }
        if (addr.s_addr == INADDR_ANY) {
                LOG_I("IPv4 address for interface '%s' not set", IFACE_NAME);
+               close(sock);
                return true;
        }
 
@@ -406,6 +408,7 @@ static bool netConfigureVs(struct nsjconf_t *nsjconf)
        }
        if (addr.s_addr == INADDR_ANY) {
                LOG_I("Gateway address for '%s' is not set", IFACE_NAME);
+               close(sock);
                return true;
        }