From: Frédéric Lécaille Date: Thu, 12 Nov 2020 20:01:54 +0000 (+0100) Subject: BUG/MINOR: peers: Missing TX cache entries reset. X-Git-Tag: v2.4-dev1~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea875e62e6b2f69c50533c5cd52eb5284c69723f;p=thirdparty%2Fhaproxy.git BUG/MINOR: peers: Missing TX cache entries reset. The TX part of a cache for a dictionary is made of an reserved array of ebtree nodes which are pointers to dictionary entries. So when we flush the TX part of such a cache, we must not only remove these nodes to dictionary entries from their ebtree. We must also reset their values. Furthermore, the LRU key and the last lookup result must also be reset. --- diff --git a/src/peers.c b/src/peers.c index 9a0f3cbdfc..6dbc3a9649 100644 --- a/src/peers.c +++ b/src/peers.c @@ -3062,8 +3062,12 @@ static inline void flush_dcache(struct peer *peer) int i; struct dcache *dc = peer->dcache; - for (i = 0; i < dc->max_entries; i++) + for (i = 0; i < dc->max_entries; i++) { ebpt_delete(&dc->tx->entries[i]); + dc->tx->entries[i].key = NULL; + } + dc->tx->prev_lookup = NULL; + dc->tx->lru_key = 0; memset(dc->rx, 0, dc->max_entries * sizeof *dc->rx); }