From 94eae336a2f8933741b5984c61616abae9b5ed8c Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 5 Dec 2017 22:59:20 +0300 Subject: [PATCH] Revert "Fix potential fd leak in listener_read_cb()" This reverts commit a695a720cda892c270736d127333d73553842094. @kgraefe: "I believe that this commit is just wrong: if lev->cnt is not 1 after the callback, new_fd will still never be closed in listener_read_cb(). So in that case it is the responsibility of the user's code to close the file descriptor (which is fine). But why shouldn't it be in the other case? And how does the user's code know?" And I agree --- listener.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/listener.c b/listener.c index 2862d32e..942fa451 100644 --- a/listener.c +++ b/listener.c @@ -421,8 +421,6 @@ listener_read_cb(evutil_socket_t fd, short what, void *p) if (lev->refcnt == 1) { int freed = listener_decref_and_unlock(lev); EVUTIL_ASSERT(freed); - - evutil_closesocket(new_fd); return; } --lev->refcnt; -- 2.50.1