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)) {