sk: don't leak socket when reading of IB GUID fails.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2017-10-16 11:40:12 +02:00 committed by Richard Cochran
parent 20a229e168
commit 18daeb6b26
1 changed files with 2 additions and 1 deletions

3
sk.c
View File

@ -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;
}