summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-09-20 17:22:30 +0200
committerantirez <antirez@gmail.com>2016-09-20 17:22:30 +0200
commit670586715a19e7aff9b3af793a7a9b334b418752 (patch)
treeaa2b9d951110685bc4416675c3c61ee1bd33bdcd
parente9d861ec69a11208578fc2a8b7dcdf4c52df316e (diff)
downloadredis-670586715a19e7aff9b3af793a7a9b334b418752.tar.gz
dict.c: fix dictGenericDelete() return ASAP condition.
Recently we moved the "return ASAP" condition for the Delete() function from checking .size to checking .used, which is smarter, however while testing the first table alone always works to ensure the dict is totally emtpy, when we test the .size field, testing .used requires testing both T0 and T1, since a rehashing could be in progress.
-rw-r--r--src/dict.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dict.c b/src/dict.c
index 04dfae6cc..b9b2390f1 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -415,7 +415,8 @@ static dictEntry *dictGenericDelete(dict *d, const void *key, int nofree) {
dictEntry *he, *prevHe;
int table;
- if (d->ht[0].used == 0) return NULL;
+ if (d->ht[0].used == 0 && d->ht[1].used == 0) return NULL;
+
if (dictIsRehashing(d)) _dictRehashStep(d);
h = dictHashKey(d, key);