diff --git a/src/cluster.c b/src/cluster.c index aa8643a8..3facef16 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -333,6 +333,8 @@ static int cluster_slot_ref_node(cluster_slot *slot, valkeyClusterNode *node) { } static void cluster_slot_destroy(cluster_slot *slot) { + if (slot == NULL) + return; slot->start = 0; slot->end = 0; slot->node = NULL; @@ -846,9 +848,7 @@ static dict *parse_cluster_slots(valkeyClusterContext *cc, valkeyReply *reply) { error: dictRelease(nodes); - if (slot != NULL) { - cluster_slot_destroy(slot); - } + cluster_slot_destroy(slot); return NULL; }