From: Andre Noll Date: Sat, 10 Jan 2009 15:52:54 +0000 (+0100) Subject: Fix an fd leak in udp_send.c. X-Git-Tag: v0.3.4~75^2~30 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=8cf6f0ecf5a3ed9c51ad72bc1c0b02a5b20e5345 Fix an fd leak in udp_send.c. In case mark_fd_nonblocking() fails, the old code leaks an open fd. --- 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)