summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Leech <cleech@redhat.com>2019-10-30 13:46:37 -0700
committerChris Leech <cleech@redhat.com>2019-10-31 15:48:08 -0700
commit98738bc389c62cef05bff9e03d5172253ebc82af (patch)
tree1fd3f42f9e4aaa302fb1f6a7c140f0fdadfbd53d
parent30dfe8b18e48fbd7950138feeea2a16b8baa5d77 (diff)
downloadopen-iscsi-98738bc389c62cef05bff9e03d5172253ebc82af.tar.gz
Resource leak: Handle variable sockfd going out of scope leaks the handle.
-rw-r--r--usr/iscsi_net_util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr/iscsi_net_util.c b/usr/iscsi_net_util.c
index 56d2f69..b5a910f 100644
--- a/usr/iscsi_net_util.c
+++ b/usr/iscsi_net_util.c
@@ -196,8 +196,10 @@ static char *find_vlan_dev(char *netdev, int vlan_id) {
strlcpy(if_hwaddr.ifr_name, netdev, IFNAMSIZ);
ioctl(sockfd, SIOCGIFHWADDR, &if_hwaddr);
- if (if_hwaddr.ifr_hwaddr.sa_family != ARPHRD_ETHER)
+ if (if_hwaddr.ifr_hwaddr.sa_family != ARPHRD_ETHER) {
+ close(sockfd);
return NULL;
+ }
ifni = if_nameindex();
for (i = 0; ifni[i].if_index && ifni[i].if_name; i++) {