pgsql: Fix set of issues with memory-allocation system calls infronten - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Fix set of issues with memory-allocation system calls infronten
Date
Msg-id E1hMpAt-0002dS-3a@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix set of issues with memory-allocation system calls in frontend code

Like the backend, the frontend has wrappers on top of malloc() and such
whose use is recommended.  Particularly, it is possible to do memory
allocation without issuing an error.  Some binaries missed the use of
those wrappers, so let's fix the gap for consistency.

This also fixes two latent bugs:
- In pg_dump/pg_dumpall when parsing an ACL item, on an out-of-memory
error for strdup(), the code considered the failure as a ACL parsing
problem instead of an actual OOM.
- In pg_waldump, an OOM when building the target directory string would
cause a crash.

Author: Daniel Gustafsson
Discussion:
https://postgr.es/m/gY0y9xenfoBPc-Tufsr2Zg-MmkrJslm0Tw_CMg4p_j58-k_PXNC0klMdkKQkg61BkXC9_uWo-DcUzfxnHqpkpoR5jjVZrPHqKYikcHIiONhg=@yesql.se

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/84e4570da9230d45022ef77f98b560f26eaf6916

Modified Files
--------------
src/bin/pg_ctl/pg_ctl.c               |  3 ++-
src/bin/pg_dump/dumputils.c           | 12 +++++-------
src/bin/pg_test_fsync/pg_test_fsync.c |  2 +-
src/bin/pg_waldump/pg_waldump.c       | 10 +++++-----
src/bin/psql/large_obj.c              |  2 +-
5 files changed, 14 insertions(+), 15 deletions(-)


pgsql-committers by date:

Previous
From: Noah Misch
Date:
Subject: pgsql: Suppress compiler warning in non-SSL, non-assert builds.
Next
From: Peter Eisentraut
Date:
Subject: pgsql: pg_dump: Fix newline in error message