Fix double free of reply in redis-cli --cluster add-node (#16053)

Fixes #16051

After the function sync step, `clusterManagerCommandAddNode()` frees
`reply` but doesn't clear the pointer. If resolving the first node's
address for `CLUSTER MEET` then fails, the `goto cleanup` frees the same
reply again. The pointer is now set to NULL after the free, so cleanup
skips it.
This commit is contained in:
Lazizbek Ergashev authored and GitHub committed 2026-10-24 10:42:58 +08:00
1 parent 81d653f5dc
commit c039dd784c
1 file changed
+4 -1
+4 -1
View File
@@ -7762,7 +7762,10 @@ static int clusterManagerCommandAddNode(int argc, char **argv) {
}
}
if (reply) freeReplyObject(reply);
if (reply) {
freeReplyObject(reply);
reply = NULL;
}
// Send CLUSTER MEET command to the new node
clusterManagerLogInfo(">>> Send CLUSTER MEET to node %s:%d to make it "