[PATCH 04/19] Removed a resource leak from nfs/rpcmisc.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



nfs/rpcmisc.c:105: leaked_handle: Handle variable "sock"
	going out of scope leaks the handle.

Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>
---
 support/nfs/rpcmisc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/support/nfs/rpcmisc.c b/support/nfs/rpcmisc.c
index abe89ba..d84c04f 100644
--- a/support/nfs/rpcmisc.c
+++ b/support/nfs/rpcmisc.c
@@ -102,6 +102,7 @@ makesock(int port, int proto)
 	if (bind(sock, (struct sockaddr *) &sin, sizeof(sin)) == -1) {
 		xlog(L_FATAL, "Could not bind name to socket: %s",
 					strerror(errno));
+		close(sock);
 		return -1;
 	}
 
-- 
2.20.1




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux