8000 Fix memory leak due to LogicalRepRelMapEntry.attrmap. · postgres/postgres@ed2a7a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed2a7a6

Browse files
author
Amit Kapila
committed
Fix memory leak due to LogicalRepRelMapEntry.attrmap.
When rebuilding the relation mapping on subscribers, we were not releasing the attribute mapping's memory which was no longer required. The attribute mapping used in logical tuple conversion was refactored in PG13 (by commit e1551f9) but we forgot to update the related code that frees the attribute map. Author: Hou Zhijie Reviewed-by: Amit Langote, Amit Kapila, Shi yu Backpatch-through: 10, where it was introduced Discussion: https://postgr.es/m/OSZPR01MB6310F46CD425A967E4AEF736FDA49@OSZPR01MB6310.jpnprd01.prod.outlook.com
1 parent d1ec8ea commit ed2a7a6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/backend/replication/logical/relation.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,13 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
259259
MemoryContext oldctx;
260260
int i;
261261

262+
/* Release the no-longer-useful attrmap, if any. */
263+
if (entry->attrmap)
264+
{
265+
pfree(entry->attrmap);
266+
entry->attrmap = NULL;
267+
}
268+
262269
/* Try to find and lock the relation by name. */
263270
relid = RangeVarGetRelid(makeRangeVar(remoterel->nspname,
264271
remoterel->relname, -1),

0 commit comments

Comments
 (0)
0