From: Olivier Houchard Date: Tue, 24 Jan 2023 22:59:32 +0000 (+0100) Subject: MINOR: connection: add a BUG_ON() to detect destroying connection in idle list X-Git-Tag: v2.8-dev3~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a0f8ba837aaa5ba8acfa21354b71818cdb87901;p=thirdparty%2Fhaproxy.git MINOR: connection: add a BUG_ON() to detect destroying connection in idle list Add a BUG_ON() in conn_free(), to check that when we're freeing a connection, it is not still in the idle connections tree, otherwise the next thread that will try to use it will probably crash. --- diff --git a/src/connection.c b/src/connection.c index 4a73dbcc80..97619ec260 100644 --- a/src/connection.c +++ b/src/connection.c @@ -498,6 +498,10 @@ void conn_free(struct connection *conn) pool_free(pool_head_uniqueid, istptr(conn->proxy_unique_id)); conn->proxy_unique_id = IST_NULL; + /* Make sure the connection is not left in the idle connection tree */ + if (conn->hash_node != NULL) + BUG_ON(conn->hash_node->node.node.leaf_p != NULL); + pool_free(pool_head_conn_hash_node, conn->hash_node); conn->hash_node = NULL;