postgresql/src
Michael Paquier c9b3d4909b 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.

To address this, a relation's attribute map is allocated in
PGOutputData's cachectx, free()'d at the end of the execution of these
SQL functions when logical decoding ends.  This is available down to 15.
v13 and v14 have a similar leak, which will be dealt with later.

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: 15
2024-12-30 13:33:09 +09:00
..
backend Fix memory leak in pgoutput with relation attribute map 2024-12-30 13:33:09 +09:00
bin Partial pgindent of .l and .y files 2024-12-25 17:55:42 +01:00
common meson: Export all libcommon functions in Windows builds 2024-12-25 18:14:18 +02:00
fe_utils Partial pgindent of .l and .y files 2024-12-25 17:55:42 +01:00
include Remove redundant wording in pg_statistic.h 2024-12-30 12:18:45 +09:00
interfaces Partial pgindent of .l and .y files 2024-12-25 17:55:42 +01:00
makefiles Use __attribute__((target(...))) for AVX-512 support. 2024-11-07 13:58:43 -06:00
pl plpgsql: Rename a variable for clarity 2024-12-26 11:11:14 +01:00
port meson: Export all libcommon functions in Windows builds 2024-12-25 19:22:25 +02:00
template thread-safety: gmtime_r(), localtime_r() 2024-08-23 07:43:04 +02:00
test Fix failures with incorrect epoch handling for 2PC files at recovery 2024-12-30 09:58:02 +09:00
timezone Update time zone data files to tzdata release 2024b. 2024-10-29 11:49:38 -04:00
tools Remove pgrminclude and associated scripts 2024-12-24 14:02:42 +01:00
tutorial Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Use <stdint.h> and <inttypes.h> for c.h integers. 2024-12-04 15:05:38 +13:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00