postgresql/src
Tom Lane 4fbfdde58e Avoid leakage of zero-length arrays in partition_bounds_copy().
If ndatums is zero, the code would allocate zero-length boundKinds
and boundDatums chunks, which would have nothing pointing to them,
leading to Valgrind complaints.  Rearrange the code to avoid the
useless pallocs, and also to not bother computing byval/typlen when
they aren't used.

I'm unsure why I didn't see this in my Valgrind testing back in May.
This code hasn't changed since then, but maybe we added a regression
test that reaches this edge case.  Or possibly I just failed to
notice the reports, which do say "0 bytes lost".

Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us
2025-08-02 21:59:46 -04:00
..
backend Avoid leakage of zero-length arrays in partition_bounds_copy(). 2025-08-02 21:59:46 -04:00
bin Fix assertion failure in pgbench when handling multiple pipeline sync messages. 2025-08-03 10:49:03 +09:00
common Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:40 -04:00
fe_utils Fix bug in archive streamer with LZ4 decompression 2025-07-02 13:48:36 +09:00
include Silence Valgrind leakage complaints in more-or-less-hackish ways. 2025-08-02 21:59:46 -04:00
interfaces libpq: Complain about missing BackendKeyData later with PGgetCancel() 2025-08-01 18:24:19 +03:00
makefiles meson: Increase minimum version to 0.57.2 2025-07-02 11:14:53 +02:00
pl Reduce leakage during PL/pgSQL function compilation. 2025-08-02 21:59:46 -04:00
port Use strchr instead of strstr for single-char lookups 2025-07-23 12:02:55 +12:00
template thread-safety: gmtime_r(), localtime_r() 2024-08-23 07:43:04 +02:00
test Fix typo in foreign_key.sql 2025-08-02 19:54:23 +09:00
timezone Update time zone data files to tzdata release 2025b. 2025-04-30 11:13:49 -04:00
tools Suppress complaints about leaks in TS dictionary loading. 2025-08-02 21:59:46 -04:00
tutorial Doc: simplify the tutorial's window-function examples. 2025-01-21 14:43:21 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:40 -04:00
Makefile.shlib Use exported symbols list on macOS for loadable modules as well 2025-06-10 07:04:43 +02:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00