From 4d1fba616447c8c877059d090ccbdfedf78cbf95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Svensson?= Date: Wed, 9 Oct 2024 21:43:40 +0200 Subject: [PATCH] Check ptr in cluster_slot_destroy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Svensson --- src/cluster.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; }