From 11df04544944bc3e607020e4396643bd0b75208a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 17 Jun 2015 00:32:53 +0000 Subject: [PATCH] iscsiadm: Fix a resource leak in an error path Detected by Coverity. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6389 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/usr/message.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iscsi-scst/usr/message.c b/iscsi-scst/usr/message.c index b68f80904..6a6802108 100644 --- a/iscsi-scst/usr/message.c +++ b/iscsi-scst/usr/message.c @@ -39,8 +39,10 @@ int iscsi_adm_request_listen(void) memcpy((char *) &addr.sun_path + 1, ISCSI_ADM_NAMESPACE, strlen(ISCSI_ADM_NAMESPACE)); - if ((err = bind(fd, (struct sockaddr *) &addr, sizeof(addr))) < 0) + if ((err = bind(fd, (struct sockaddr *) &addr, sizeof(addr))) < 0) { + close(fd); return err; + } if ((err = listen(fd, 32)) < 0) { close(fd);