mirror of
http://github.com/valkey-io/valkey
synced 2024-11-23 11:51:01 +00:00
Don't crash when adding a forgotten node to blacklist twice (#12702)
Add a defensive checks to prevent double freeing a node from the cluster blacklist.
This commit is contained in:
parent
4bbb2b0152
commit
8d675950e6
@ -1131,6 +1131,9 @@ void clusterReset(int hard) {
|
||||
}
|
||||
dictReleaseIterator(di);
|
||||
|
||||
/* Empty the nodes blacklist. */
|
||||
dictEmpty(server.cluster->nodes_black_list, NULL);
|
||||
|
||||
/* Hard reset only: set epochs to 0, change node ID. */
|
||||
if (hard) {
|
||||
sds oldname;
|
||||
@ -2651,8 +2654,7 @@ void clusterProcessPingExtensions(clusterMsg *hdr, clusterLink *link) {
|
||||
clusterNode *n = clusterLookupNode(forgotten_node_ext->name, CLUSTER_NAMELEN);
|
||||
if (n && n != myself && !(nodeIsSlave(myself) && myself->slaveof == n)) {
|
||||
sds id = sdsnewlen(forgotten_node_ext->name, CLUSTER_NAMELEN);
|
||||
dictEntry *de = dictAddRaw(server.cluster->nodes_black_list, id, NULL);
|
||||
serverAssert(de != NULL);
|
||||
dictEntry *de = dictAddOrFind(server.cluster->nodes_black_list, id);
|
||||
uint64_t expire = server.unixtime + ntohu64(forgotten_node_ext->ttl);
|
||||
dictSetUnsignedIntegerVal(de, expire);
|
||||
clusterDelNode(n);
|
||||
|
Loading…
Reference in New Issue
Block a user