summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2024-06-27 10:43:52 +0530
committerAmit Kapila <akapila@postgresql.org>2024-06-27 10:43:52 +0530
commit76fda614027436ca030e1fac4fe33484e995970f (patch)
treebf20c84e80958a22324cf6c2c546a9ceaccc68e5
parenteb144dfcafdd7fcce817c75db0c353667b819e11 (diff)
Drop the temporary tuple slots allocated by pgoutput.
In pgoutput, when converting the child table's tuple format to match the parent table's, we temporarily create a new slot to store the converted tuple. However, we missed to drop such temporary slots, leading to resource leakage. Reported-by: Bowen Shi Author: Hou Zhijie Reviewed-by: Amit Kapila Backpatch-through: 15 Discussion: https://postgr.es/m/CAM_vCudv8dc3sjWiPkXx5F2b27UV7_YRKRbtSCcE-pv=cVACGA@mail.gmail.com
-rw-r--r--src/backend/replication/pgoutput/pgoutput.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index 5fc0defec3a..abb82ecb18d 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -1587,6 +1587,16 @@ pgoutput_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
ancestor = NULL;
}
+ /* Drop the new slots that were used to store the converted tuples. */
+ if (relentry->attrmap)
+ {
+ if (old_slot)
+ ExecDropSingleTupleTableSlot(old_slot);
+
+ if (new_slot)
+ ExecDropSingleTupleTableSlot(new_slot);
+ }
+
/* Cleanup */
MemoryContextSwitchTo(old);
MemoryContextReset(data->context);