From 18daeb6b263b90cf1a3ebb790df4ca60d930799c Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 16 Oct 2017 11:40:12 +0200 Subject: [PATCH] sk: don't leak socket when reading of IB GUID fails. Signed-off-by: Miroslav Lichvar --- sk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sk.c b/sk.c index 0cf55c5..2c7593b 100644 --- a/sk.c +++ b/sk.c @@ -225,6 +225,8 @@ int sk_interface_macaddr(const char *name, struct address *mac) return -1; } + close(fd); + /* Get interface type */ type = ifreq.ifr_hwaddr.sa_family; switch (type) { @@ -243,7 +245,6 @@ int sk_interface_macaddr(const char *name, struct address *mac) mac->sll.sll_family = AF_PACKET; mac->len = sizeof(mac->sll); - close(fd); return 0; }