summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dict.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dict.c b/src/dict.c
index 9ba0d7d7e..3b23fbcd0 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;
}