From 8cf6f0ecf5a3ed9c51ad72bc1c0b02a5b20e5345 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 10 Jan 2009 16:52:54 +0100 Subject: [PATCH] Fix an fd leak in udp_send.c. In case mark_fd_nonblocking() fails, the old code leaks an open fd. --- udp_send.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/udp_send.c b/udp_send.c index 9e03b402..50161c13 100644 --- a/udp_send.c +++ b/udp_send.c @@ -84,7 +84,10 @@ static int udp_init_session(struct udp_target *ut) if (ret < 0) return ret; ut->fd = ret; - return mark_fd_nonblocking(ut->fd); + ret = mark_fd_nonblocking(ut->fd); + if (ret < 0) + close(ut->fd); + return ret; } static void udp_shutdown_targets(void) -- 2.39.5