| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix mismatched deallocation functions |
| Date: | 2026-07-01 11:55:07 |
| Message-ID: | E1wetX2-000uWy-0V@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix mismatched deallocation functions
In fe_memutils.h, we have various allocation functions beginning with
either pg_ or p. The pg_ functions have a matching pg_free() for
freeing memory, while the p functions use pfree(). In some cases, we
were allocating memory with one set of functions while using the wrong
deallocation functions. This creates a tiny bit of mental overhead
when reading code. Matching up allocation and deallocation functions
makes it easier to analyze memory handling in a code path.
Author: Tristan Partin <tristan(at)partin(dot)io>
Reviewed-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/DIBZE2B6SVF2(dot)28R3EQTYJSWIG(at)partin(dot)io
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/30652b356d20c1d3772137370a6a8d29575e04d1
Modified Files
--------------
contrib/oid2name/oid2name.c | 6 +-
src/bin/initdb/initdb.c | 14 +--
src/bin/pg_basebackup/pg_basebackup.c | 4 +-
src/bin/pg_basebackup/pg_createsubscriber.c | 12 +--
src/bin/pg_basebackup/streamutil.c | 8 +-
src/bin/pg_combinebackup/load_manifest.c | 2 +-
src/bin/pg_combinebackup/pg_combinebackup.c | 2 +-
src/bin/pg_combinebackup/reconstruct.c | 8 +-
src/bin/pg_ctl/pg_ctl.c | 10 +-
src/bin/pg_dump/compress_gzip.c | 8 +-
src/bin/pg_dump/compress_lz4.c | 2 +-
src/bin/pg_dump/compress_none.c | 2 +-
src/bin/pg_dump/connectdb.c | 12 +--
src/bin/pg_dump/dumputils.c | 4 +-
src/bin/pg_dump/parallel.c | 2 +-
src/bin/pg_dump/pg_backup_archiver.c | 28 ++---
src/bin/pg_dump/pg_backup_custom.c | 4 +-
src/bin/pg_dump/pg_backup_db.c | 4 +-
src/bin/pg_dump/pg_backup_directory.c | 2 +-
src/bin/pg_dump/pg_backup_tar.c | 6 +-
src/bin/pg_dump/pg_dump.c | 128 +++++++++++------------
src/bin/pg_dump/pg_dump_sort.c | 12 +--
src/bin/pg_dump/pg_dumpall.c | 4 +-
src/bin/pg_upgrade/check.c | 8 +-
src/bin/pg_upgrade/function.c | 2 +-
src/bin/pg_verifybackup/pg_verifybackup.c | 4 +-
src/bin/pgbench/pgbench.c | 4 +-
src/bin/psql/command.c | 10 +-
src/bin/psql/common.c | 4 +-
src/bin/psql/describe.c | 14 +--
src/bin/psql/help.c | 2 +-
src/bin/psql/input.c | 2 +-
src/bin/psql/large_obj.c | 4 +-
src/bin/psql/mainloop.c | 12 +--
src/bin/psql/prompt.c | 4 +-
src/bin/psql/startup.c | 14 +--
src/bin/psql/stringutils.c | 6 +-
src/bin/psql/tab-complete.in.c | 32 +++---
src/bin/scripts/vacuuming.c | 2 +-
src/common/logging.c | 2 +-
src/fe_utils/print.c | 40 +++----
src/interfaces/ecpg/test/pg_regress_ecpg.c | 2 +-
src/test/isolation/isolation_main.c | 2 +-
src/test/isolation/isolationtester.c | 10 +-
src/test/modules/libpq_pipeline/libpq_pipeline.c | 8 +-
src/test/regress/pg_regress.c | 6 +-
src/test/regress/pg_regress_main.c | 2 +-
47 files changed, 240 insertions(+), 240 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-07-01 11:58:32 | pgsql: Warn on password auth with MD5-encrypted passwords |
| Previous Message | Peter Eisentraut | 2026-07-01 08:21:26 | pgsql: Split dry-run messages into primary and detail |