diff mbox series

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

Message ID 20190508133536.6077-5-steved@redhat.com (mailing list archive)
State New, archived
Headers show
Series Covertity Scan: Removed resources leaks | expand

Commit Message

Steve Dickson May 8, 2019, 1:35 p.m. UTC
nfs/rpcmisc.c:105: leaked_handle: Handle variable "sock"
	going out of scope leaks the handle.

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

Patch

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;
 	}