From: Fredrik Tolf Date: Sat, 31 Aug 2024 14:29:22 +0000 (+0200) Subject: ratequeue: Fix rehash bug again. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=f905ca5d7cbaf53e638c005765f92d06438f6442;p=ashd.git ratequeue: Fix rehash bug again. --- diff --git a/src/ratequeue.c b/src/ratequeue.c index a05187a..c349f18 100644 --- a/src/ratequeue.c +++ b/src/ratequeue.c @@ -160,12 +160,13 @@ static void rehash(int nlen) if(nlen <= SBUCKETS) { nlen = SBUCKETS; new = sbuckets; - memset(sbuckets, 0, sizeof(sbuckets)); } else { new = szmalloc(sizeof(*new) * (1 << nlen)); } if(nlen == hashlen) return; + if(new == sbuckets) + memset(sbuckets, 0, sizeof(sbuckets)); assert(old != new); pl = 1 << hashlen; nl = 1 << nlen; m = nl - 1; for(i = 0; i < pl; i++) {