From 41e3392f30d4596a632c4d137e668fc18e76c447 Mon Sep 17 00:00:00 2001 From: Maksim Korotkov Date: Sun, 13 Oct 2024 19:24:19 +0300 Subject: [PATCH] casual blocks: fixed potential NULL dereference The result of FindWorkerNode() is usually checked against NULL. Signed-off-by: Maksim Korotkov --- src/backend/distributed/clock/causal_clock.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/distributed/clock/causal_clock.c b/src/backend/distributed/clock/causal_clock.c index eb4b8d9d3..42d732a1f 100644 --- a/src/backend/distributed/clock/causal_clock.c +++ b/src/backend/distributed/clock/causal_clock.c @@ -431,6 +431,11 @@ PrepareAndSetTransactionClock(void) MultiConnection *connection = dlist_container(MultiConnection, transactionNode, iter.cur); WorkerNode *workerNode = FindWorkerNode(connection->hostname, connection->port); + if (!workerNode) + { + ereport(WARNING, errmsg("Worker node is missing")); + continue; + } /* Skip the node if we already in the list */ if (list_member_int(nodeList, workerNode->groupId))