]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Fix an fd leak in udp_send.c.
authorAndre Noll <maan@systemlinux.org>
Sat, 10 Jan 2009 15:52:54 +0000 (16:52 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 10 Jan 2009 15:52:54 +0000 (16:52 +0100)
In case mark_fd_nonblocking() fails, the old code leaks an open fd.

udp_send.c

index 9e03b402fe18d2a9d0584c2653a8d7baeb78af35..50161c1333642d2021b47c3b0a05ff4bd43f10f6 100644 (file)
@@ -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)