summaryrefslogtreecommitdiff
path: root/src/backend/replication/slotfuncs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/replication/slotfuncs.c')
-rw-r--r--src/backend/replication/slotfuncs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/replication/slotfuncs.c b/src/backend/replication/slotfuncs.c
index 69f4c6157c5..b8f21153e7b 100644
--- a/src/backend/replication/slotfuncs.c
+++ b/src/backend/replication/slotfuncs.c
@@ -921,7 +921,6 @@ pg_sync_replication_slots(PG_FUNCTION_ARGS)
/* Connect to the primary server. */
wrconn = walrcv_connect(PrimaryConnInfo, false, false, false,
app_name.data, &err);
- pfree(app_name.data);
if (!wrconn)
ereport(ERROR,
@@ -929,6 +928,8 @@ pg_sync_replication_slots(PG_FUNCTION_ARGS)
errmsg("synchronization worker \"%s\" could not connect to the primary server: %s",
app_name.data, err));
+ pfree(app_name.data);
+
SyncReplicationSlots(wrconn);
walrcv_disconnect(wrconn);