From 7d49d9b4a135f97e6d94ffe14979259ecd3f0cae Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 8 Sep 2015 10:01:31 +0200 Subject: [PATCH] ctdb-server: fix a possible fd leak in ctdb_tcp_listen_automatic() sockets are created in a loop until an unused address is found. But the unused socket fds were not closed. Signed-off-by: Michael Adam Reviewed-by: Martin Schwenke --- ctdb/tcp/tcp_connect.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c index b106f22c86f..277eb375ba9 100644 --- a/ctdb/tcp/tcp_connect.c +++ b/ctdb/tcp/tcp_connect.c @@ -338,6 +338,8 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb) DEBUG(DEBUG_ERR,(__location__ " Failed to bind() to socket. %s(%d)\n", strerror(errno), errno)); } + + close(ctcp->listen_fd); } if (i == ctdb->num_nodes) { -- 2.11.4.GIT