From a53c9c5a8d9e44998d0d7f1ca7b293ae793bb051 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index 00e7024563..b0a5884dd4 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -2055,9 +2055,19 @@ get_rel_sync_entry(PGOutputData *data, Relation relation) * Tuple slots cleanups. (Will be rebuilt later if needed). */ if (entry->old_slot) + { + Assert(entry->old_slot->tts_tupleDescriptor->tdrefcount == -1); + + FreeTupleDesc(entry->old_slot->tts_tupleDescriptor); ExecDropSingleTupleTableSlot(entry->old_slot); + } if (entry->new_slot) + { + Assert(entry->new_slot->tts_tupleDescriptor->tdrefcount == -1); + + FreeTupleDesc(entry->new_slot->tts_tupleDescriptor); ExecDropSingleTupleTableSlot(entry->new_slot); + } entry->old_slot = NULL; entry->new_slot = NULL; -- 2.32.0.3.g01195cf9f