Avoid leaking fds on evconnlistener with no callback set

There's no way to retrieve an fd from an evconnlistener whose
callback has been cleared, so we had better close any such fd.

Found by coverity; CID 739725.
This commit is contained in:
Nick Mathewson 2012-12-20 11:47:09 -05:00
parent 7e45739e26
commit 69db2610be

View File

@ -407,6 +407,7 @@ listener_read_cb(evutil_socket_t fd, short what, void *p)
evutil_make_socket_nonblocking(new_fd); evutil_make_socket_nonblocking(new_fd);
if (lev->cb == NULL) { if (lev->cb == NULL) {
evutil_closesocket(new_fd);
UNLOCK(lev); UNLOCK(lev);
return; return;
} }