aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2017-02-22 03:36:02 +0900
committerFujii Masao <fujii@postgresql.org>2017-02-22 03:36:02 +0900
commit898a792eb8283e31efc0b6fcbc03bbcd5f7df667 (patch)
treefd229310ec480ed42de6d358af1068219820fe26
parent1d04a59be31bf004b880226be0e3fe84acff2815 (diff)
downloadpostgresql-898a792eb8283e31efc0b6fcbc03bbcd5f7df667.tar.gz
postgresql-898a792eb8283e31efc0b6fcbc03bbcd5f7df667.zip
Fix connection leak in DROP SUBSCRIPTION command.
Previously the command forgot to close the connection to the publisher when it failed to drop the replication slot.
-rw-r--r--src/backend/commands/subscriptioncmds.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index ab21e64b488..c9e7c08c8c1 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -546,10 +546,14 @@ DropSubscription(DropSubscriptionStmt *stmt)
errdetail("The error was: %s", err)));
if (!walrcv_command(wrconn, cmd.data, &err))
+ {
+ /* Close the connection in case of failure */
+ walrcv_disconnect(wrconn);
ereport(ERROR,
(errmsg("could not drop the replication slot \"%s\" on publisher",
slotname),
errdetail("The error was: %s", err)));
+ }
else
ereport(NOTICE,
(errmsg("dropped replication slot \"%s\" on publisher",