summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Leech <cleech@redhat.com>2019-10-30 13:59:31 -0700
committerChris Leech <cleech@redhat.com>2019-10-31 15:48:08 -0700
commitca6eb221321c0e24b94f667ecc75a5fc17aa2018 (patch)
treefd520c3f19c2b0ec96a1d84d5accc62fb96e6a1c
parent096fc3ca10492c0810f1aaf76266006a2a803109 (diff)
downloadopen-iscsi-ca6eb221321c0e24b94f667ecc75a5fc17aa2018.tar.gz
Resource leak: Handle variable fd going out of scope leaks the handle.
This is comming up in places where the error handling assumes that on a failure there is no file descriptor to worry about. I don't think we need to keep fd around when indicating a connection error.
-rw-r--r--usr/iscsid_req.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c
index 427e894..d872eb7 100644
--- a/usr/iscsid_req.c
+++ b/usr/iscsid_req.c
@@ -97,6 +97,8 @@ static int ipc_connect(int *fd, char *unix_sock_name, int start_iscsid)
if (nsec <= MAXSLEEP/2)
sleep(nsec);
}
+ close(*fd);
+ *fd = -1;
log_error("can not connect to iSCSI daemon (%d)!", errno);
return ISCSI_ERR_ISCSID_NOTCONN;
}