]> granicus.if.org Git - libevent/commitdiff
Fix an fd leak in evconnlistener_new_bind().
authorJardel Weyrich <jweyrich@users.sourceforge.net>
Mon, 28 Dec 2009 21:01:12 +0000 (16:01 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 28 Dec 2009 21:01:12 +0000 (16:01 -0500)
listener.c

index c65538fae0e79635e3f2884cff11126678887393..7ebfdf083d977cb1a7fd3a0c978460f30ecca10c 100644 (file)
@@ -158,8 +158,10 @@ evconnlistener_new_bind(struct event_base *base, evconnlistener_cb cb,
        fd = socket(family, SOCK_STREAM, 0);
        if (fd == -1)
                return NULL;
-       if (evutil_make_socket_nonblocking(fd) < 0)
+       if (evutil_make_socket_nonblocking(fd) < 0) {
+               EVUTIL_CLOSESOCKET(fd);
                return NULL;
+       }
 
 #ifndef WIN32
        if (flags & LEV_OPT_CLOSE_ON_EXEC) {