pgsql: Fix set of issues with memory-allocation system calls in fronten

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix set of issues with memory-allocation system calls in fronten
Date: 2019-05-04 07:33:35
Message-ID: E1hMpAt-0002dS-3a@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2019-05-04 14:58:01 pgsql: pg_dump: Fix newline in error message
Previous Message Noah Misch 2019-05-04 04:58:11 pgsql: MSVC: Build ~35% faster by calling dumpbin just once per directo