diff options
author | Amit Kapila <akapila@postgresql.org> | 2024-06-27 11:35:00 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2024-06-27 11:35:00 +0530 |
commit | 3e53492aa7084bceaa92757c90e067d79768797e (patch) | |
tree | 9021716dc7e6fc90cb4cde3091783f48e2607caa /src | |
parent | 7467939ea226ebc5608285486501b136b642c02b (diff) | |
download | postgresql-3e53492aa7084bceaa92757c90e067d79768797e.tar.gz postgresql-3e53492aa7084bceaa92757c90e067d79768797e.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/replication/pgoutput/pgoutput.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index d2b35cfb96d..abef4eaf68b 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -1554,6 +1554,16 @@ cleanup: 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); + } + MemoryContextSwitchTo(old); MemoryContextReset(data->context); } |