diff options
author | Michael Paquier <michael@paquier.xyz> | 2025-01-08 08:47:19 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2025-01-08 08:47:19 +0900 |
commit | c53d90bb47ae488beebe64d651ef926c86a51bde (patch) | |
tree | 336bbc579057844f1573fb2dee1646c6b528fb94 /src/backend/executor/nodeModifyTable.c | |
parent | f154f028d856bf5ad6ec419d7947865c172d14ae (diff) | |
download | postgresql-c53d90bb47ae488beebe64d651ef926c86a51bde.tar.gz postgresql-c53d90bb47ae488beebe64d651ef926c86a51bde.zip |
Fix memory leak in pgoutput with relation attribute map
pgoutput caches the attribute map of a relation, that is free()'d only
when validating a RelationSyncEntry. However, this code path is not
taken when calling any of the SQL functions able to do some logical
decoding, like pg_logical_slot_{get,peek}_changes(), leaking some memory
into CacheMemoryContext on repeated calls.
This is a follow-up of c9b3d4909bbf, this time for v13 and v14. The
relation attribute map is stored in a dedicated memory context, tracked
with a static variable whose state is reset with a MemoryContext reset
callback attached to PGOutputData->context. This implementation is
similar to the approach taken by cfd6cbcf9be0.
Reported-by: Masahiko Sawada
Author: Vignesh C
Reviewed-by: Hou Zhijie
Discussion: https://postgr.es/m/CAD21AoDkAhQVSukOfH3_reuF-j4EU0-HxMqU3dU+bSTxsqT14Q@mail.gmail.com
Discussion: https://postgr.es/m/CALDaNm1hewNAsZ_e6FF52a=9drmkRJxtEPrzCB6-9mkJyeBBqA@mail.gmail.com
Backpatch-through: 13
Diffstat (limited to 'src/backend/executor/nodeModifyTable.c')
0 files changed, 0 insertions, 0 deletions