Skip to content

Commit 16df3d5

Browse files
Amit Kapilamy-ship-it
authored andcommitted
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 93dd69b commit 16df3d5

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
@@ -313,6 +313,13 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
313313
int i;
314314
Bitmapset *missingatts;
315315

316+
/* Release the no-longer-useful attrmap, if any. */
317+
if (entry->attrmap)
318+
{
319+
pfree(entry->attrmap);
320+
entry->attrmap = NULL;
321+
}
322+
316323
/* Try to find and lock the relation by name. */
317324
relid = RangeVarGetRelid(makeRangeVar(remoterel->nspname,
318325
remoterel->relname, -1),

0 commit comments

Comments
 (0)