From 8f3b31377624e6b8ce48cda4404dc3243649fc6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gomez?= Date: Tue, 30 Jan 2024 22:30:27 +0900 Subject: [PATCH] Fix file descriptor leak on erroring client disconnects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Client connections in error also need to be closed/freed - This fixes a file descriptor leak that would result in a bip crash Signed-off-by: Loïc Gomez --- src/connection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connection.c b/src/connection.c index 0a138eb..0c0eb99 100644 --- a/src/connection.c +++ b/src/connection.c @@ -62,7 +62,7 @@ void connection_close(connection_t *cn) { mylog(LOG_DEBUG, "Connection close asked. FD:%d (status: %d)", (long)cn->handle, cn->connected); - if (cn->connected != CONN_DISCONN && cn->connected != CONN_ERROR) { + if (cn->connected != CONN_DISCONN) { cn->connected = CONN_DISCONN; if (close(cn->handle) == -1) mylog(LOG_WARN, "Error on socket close: %s",