Fix invalid dictNext usage when pubsubshard_channels became empty (#13033)
After #12822, when pubsubshard_channels became empty, kvstoreDictDelete will delete the dict (which is the only one currently deleting dicts that become empty) and in the next loop, we will make an invalid call to dictNext. After the dict becomes empty, we break out of the loop without calling dictNext.
This commit is contained in:
parent
13bd3643c2
commit
8096515432
@ -350,6 +350,9 @@ void pubsubShardUnsubscribeAllChannelsInSlot(unsigned int slot) {
|
||||
}
|
||||
dictReleaseIterator(iter);
|
||||
kvstoreDictDelete(server.pubsubshard_channels, slot, channel);
|
||||
/* After the dict becomes empty, the dict will be deleted.
|
||||
* We break out without calling dictNext. */
|
||||
if (!kvstoreDictSize(server.pubsubshard_channels, slot)) break;
|
||||
}
|
||||
dictReleaseIterator(di);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user