diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 0564c99550..74a5f9622f 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -488,6 +488,7 @@ ReadReplicationSlot(ReadReplicationSlotCmd *cmd)
 	TupleDesc	tupdesc;
 	Datum		values[READ_REPLICATION_SLOT_COLS] = {0};
 	bool		nulls[READ_REPLICATION_SLOT_COLS];
+	char		xloc[64];
 
 	tupdesc = CreateTemplateTupleDesc(READ_REPLICATION_SLOT_COLS);
 	TupleDescInitBuiltinEntry(tupdesc, (AttrNumber) 1, "slot_type",
@@ -531,8 +532,6 @@ ReadReplicationSlot(ReadReplicationSlotCmd *cmd)
 		/* start LSN */
 		if (XLogRecPtrIsValid(slot_contents.data.restart_lsn))
 		{
-			char		xloc[64];
-
 			snprintf(xloc, sizeof(xloc), "%X/%08X",
 					 LSN_FORMAT_ARGS(slot_contents.data.restart_lsn));
 			values[i] = CStringGetTextDatum(xloc);
