aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/replication/pgoutput/pgoutput.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index a6002b223df..5e23453f071 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -2095,10 +2095,34 @@ get_rel_sync_entry(PGOutputData *data, Relation relation)
* Tuple slots cleanups. (Will be rebuilt later if needed).
*/
if (entry->old_slot)
+ {
+ TupleDesc desc = entry->old_slot->tts_tupleDescriptor;
+
+ Assert(desc->tdrefcount == -1);
+
ExecDropSingleTupleTableSlot(entry->old_slot);
+
+ /*
+ * ExecDropSingleTupleTableSlot() would not free the TupleDesc, so
+ * do it now to avoid any leaks.
+ */
+ FreeTupleDesc(desc);
+ }
if (entry->new_slot)
+ {
+ TupleDesc desc = entry->new_slot->tts_tupleDescriptor;
+
+ Assert(desc->tdrefcount == -1);
+
ExecDropSingleTupleTableSlot(entry->new_slot);
+ /*
+ * ExecDropSingleTupleTableSlot() would not free the TupleDesc, so
+ * do it now to avoid any leaks.
+ */
+ FreeTupleDesc(desc);
+ }
+
entry->old_slot = NULL;
entry->new_slot = NULL;