From aa3de042324f4fd71dece81d7776e18d98ec376d 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 e0adfbc9..9b2be81f 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; }