From 3e6d9d1abf18fb36805eac25f765b3cd388b44f6 Mon Sep 17 00:00:00 2001 From: "yangboyu.yby" Date: Sat, 16 Nov 2024 16:26:02 +0800 Subject: [PATCH] Fix memory leak in pgoutput --- src/backend/replication/pgoutput/pgoutput.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index 00e7024563..390f41494e 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -2055,9 +2055,25 @@ 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); + + FreeTupleDesc(desc); + desc = NULL; ExecDropSingleTupleTableSlot(entry->old_slot); + } if (entry->new_slot) + { + TupleDesc desc = entry->new_slot->tts_tupleDescriptor; + + Assert(desc->tdrefcount == -1); + + FreeTupleDesc(desc); + desc = NULL; ExecDropSingleTupleTableSlot(entry->new_slot); + } entry->old_slot = NULL; entry->new_slot = NULL; -- 2.32.0.3.g01195cf9f