Signed-off-by: Miroslav Lichvar <[email protected]>
---
 clock.c | 2 ++
 rtnl.c  | 1 +
 2 files changed, 3 insertions(+)

diff --git a/clock.c b/clock.c
index a6a1a1a..9481606 100644
--- a/clock.c
+++ b/clock.c
@@ -824,11 +824,13 @@ static int clock_add_port(struct clock *c, int phc_index,
        }
        index = sk_interface_index(fd, iface->name);
        if (index < 0) {
+               close(fd);
                return -1;
        }
        snprintf(key, sizeof(key), "%d", index);
        if (hash_insert(c->index2port, key, p)) {
                pr_err("failed to add port with index %d twice!", index);
+               close(fd);
                return -1;
        }
        close(fd);
diff --git a/rtnl.c b/rtnl.c
index 7f5dc45..251b5f3 100644
--- a/rtnl.c
+++ b/rtnl.c
@@ -160,6 +160,7 @@ int rtnl_open(void)
        }
        if (bind(fd, (struct sockaddr *) &sa, sizeof(sa))) {
                pr_err("failed to bind netlink socket: %m");
+               close(fd);
                return -1;
        }
        return fd;
-- 
2.9.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to