Skip to content

Commit

Permalink
Check ptr in cluster_slot_destroy
Browse files Browse the repository at this point in the history
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
  • Loading branch information
bjosv committed Oct 9, 2024
1 parent d6586c7 commit 4d1fba6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 4d1fba6

Please sign in to comment.