From 9a14a954fd82d9e31e2b3005c517b6074b2ca437 Mon Sep 17 00:00:00 2001
From: Vignesh C <vignesh21@gmail.com>
Date: Mon, 11 Mar 2024 09:15:13 +0530
Subject: [PATCH v27 6/6] Fix double free issue.

While the subscriber configurations was being checked, in few error
cases, disconnect_database was being called again which was not requied.
---
 src/bin/pg_basebackup/pg_createsubscriber.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 571e3e0a55..41b548304b 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -947,7 +947,7 @@ check_subscriber(struct LogicalRepInfo *dbinfo)
 					 num_dbs, max_repslots);
 		pg_log_error_hint("Consider increasing max_replication_slots to at least %d.",
 						  num_dbs);
-		disconnect_database(conn, true);
+		exit(1);
 	}
 
 	if (max_lrworkers < num_dbs)
@@ -956,7 +956,7 @@ check_subscriber(struct LogicalRepInfo *dbinfo)
 					 num_dbs, max_lrworkers);
 		pg_log_error_hint("Consider increasing max_logical_replication_workers to at least %d.",
 						  num_dbs);
-		disconnect_database(conn, true);
+		exit(1);
 	}
 
 	if (max_wprocs < num_dbs + 1)
@@ -965,7 +965,7 @@ check_subscriber(struct LogicalRepInfo *dbinfo)
 					 num_dbs + 1, max_wprocs);
 		pg_log_error_hint("Consider increasing max_worker_processes to at least %d.",
 						  num_dbs + 1);
-		disconnect_database(conn, true);
+		exit(1);
 	}
 }
 
-- 
2.34.1

