From fc38930fd990f4e5ff9989bd67b54375d20211cd Mon Sep 17 00:00:00 2001 From: Keith Moore Date: Tue, 23 Nov 2021 13:20:50 -0500 Subject: [PATCH] fix TAILQ_REMOVE on empty queue --- http.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/http.c b/http.c index 45bfa04ddf..12eb2f3a37 100644 --- a/http.c +++ b/http.c @@ -1323,8 +1323,10 @@ evhttp_connection_free(struct evhttp_connection *evcon) if (evcon->http_server != NULL) { struct evhttp *http = evcon->http_server; - TAILQ_REMOVE(&http->connections, evcon, next); - http->connection_cnt--; + if (!TAILQ_EMPTY(&http->connections)) { + TAILQ_REMOVE(&http->connections, evcon, next); + http->connection_cnt--; + } } if (event_initialized(&evcon->retry_ev)) {