aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/socket.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c
index 8c3d9ab..9564caf 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -300,8 +300,10 @@ ssize_t socket_get_ifnames(const psocket *test_sock, char name[][IFNAMSIZ],
ifc.ifc_len = sizeof buf;
ifc.ifc_buf = buf;
- if (ioctl(sock, SIOCGIFCONF, &ifc) == -1)
+ if (ioctl(sock, SIOCGIFCONF, &ifc) == -1) {
+ close(sock);
return -1;
+ }
it = ifc.ifc_req;
end = it + (ifc.ifc_len / sizeof(struct ifreq));