Skip to content

Commit

Permalink
sk: don't leak socket when reading of IB GUID fails.
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Lichvar <[email protected]>
  • Loading branch information
mlichvar authored and richardcochran committed Oct 16, 2017
1 parent 20a229e commit 18daeb6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down

0 comments on commit 18daeb6

Please sign in to comment.