From 2385630d0d245482027e9e36c76d6f8675dd2f6b Mon Sep 17 00:00:00 2001 From: Sun He Date: Fri, 6 Feb 2015 11:18:58 +0800 Subject: [PATCH] dict.c/dictRehash: check again to update --- src/dict.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dict.c b/src/dict.c index 9ba0d7d7..3b23fbcd 100644 --- a/src/dict.c +++ b/src/dict.c @@ -282,6 +282,13 @@ int dictRehash(dict *d, int n) { d->ht[0].table[d->rehashidx] = NULL; d->rehashidx++; } + /* Check again if we already rehashed the whole table... */ + if (d->ht[0].used == 0) { + zfree(d->ht[0].table); + d->ht[0] = d->ht[1]; + _dictReset(&d->ht[1]); + d->rehashidx = -1; + } return 1; }