postgresql/src
Tom Lane 02a38bc84b Repair memory leaks in plpython.
PLy_spi_execute_plan (PLyPlan.execute) and PLy_cursor_plan
(plpy.cursor) use PLy_output_convert to convert Python values
into Datums that can be passed to the query-to-execute.  But they
failed to pay much attention to its warning that it can leave "cruft
generated along the way" behind.  Repeated use of these methods can
result in a substantial memory leak for the duration of the calling
plpython function.

To fix, make a temporary memory context to invoke PLy_output_convert
in.  This also lets us get rid of the rather fragile code that was
here for retail pfree's of the converted Datums.  Indeed, we don't
need the PLyPlanObject.values field anymore at all, though I left it
in place in the back branches in the name of ABI stability.

Mat Arye and Tom Lane, per report from Mat Arye.  Back-patch to all
supported branches.

Discussion: https://postgr.es/m/CADsUR0DvVgnZYWwnmKRK65MZg7YLUSTDLV61qdnrwtrAJgU6xw@mail.gmail.com
2025-01-11 11:45:56 -05:00
..
backend Fix missing ldapscheme option in pg_hba_file_rules() 2025-01-10 22:02:58 +01:00
bin Fix off_t overflow in pg_basebackup on Windows. 2025-01-09 16:05:36 +13:00
common Fix overread in JSON parsing errors for incomplete byte sequences 2024-05-09 12:45:51 +09:00
fe_utils Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
include Provide 64-bit ftruncate() and lseek() on Windows. 2025-01-09 14:57:02 +13:00
interfaces Fix broken list-munging in ecpg's remove_variables(). 2024-12-01 14:15:37 -05:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Repair memory leaks in plpython. 2025-01-11 11:45:56 -05:00
port Fix lstat() for broken junction points on Windows. 2024-11-08 09:46:39 +10:30
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:29:08 -04:00
test In REASSIGN OWNED of a database, lock the tuple as mandated. 2024-12-28 07:16:27 -08:00
timezone Update time zone data files to tzdata release 2024b. 2024-10-29 11:50:10 -04:00
tools Skip SectionMemoryManager.h in cpluspluscheck. 2024-11-28 15:48:52 +13:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Suppress macOS warnings about duplicate libraries in link commands. 2023-09-29 14:07:30 -04:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00