From afcda3feff38895fec72aed71c986163a2fc5853 Mon Sep 17 00:00:00 2001 From: Maxim Korotkov Date: Wed, 5 Mar 2025 16:05:21 +0300 Subject: [PATCH] casual blocks: fixed potential NULL dereference (#7704) The result of FindWorkerNode() is usually checked against NULL. --- 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))