2019-05-08 13:47:45

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 04/19] Removed a resource leak from nfs/rpcmisc.c

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

Signed-off-by: Steve Dickson <[email protected]>
---
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