v3-0001-Fix-memory-leak-in-pgoutput.patch
application/octet-stream
Filename: v3-0001-Fix-memory-leak-in-pgoutput.patch
Type: application/octet-stream
Part: 0
Message:
Re: memory leak in pgoutput
Patch
Format: format-patch
Series: patch v3-0001
Subject: Fix memory leak in pgoutput
| File | + | − |
|---|---|---|
| src/backend/replication/pgoutput/pgoutput.c | 16 | 0 |
From 242bff0c2fecf6b777bfd72ac077810822d8015d Mon Sep 17 00:00:00 2001
From: "yangboyu.yby" <yangboyu.yby@alibaba-inc.com>
Date: Wed, 20 Nov 2024 11:14:09 +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 00e7024563e..36b2c5fbbfe 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