pgsql: Fix a bunch of places that called malloc and friends with no NUL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix a bunch of places that called malloc and friends with no NUL
Date: 2016-08-30 22:22:51
Message-ID: E1berQh-0005Kp-0d@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix a bunch of places that called malloc and friends with no NULL check.

Where possible, use palloc or pg_malloc instead; otherwise, insert
explicit NULL checks.

Generally speaking, these are places where an actual OOM is quite
unlikely, either because they're in client programs that don't
allocate all that much, or they're very early in process startup
so that we'd likely have had a fork() failure instead. Hence,
no back-patch, even though this is nominally a bug fix.

Michael Paquier, with some adjustments by me

Discussion: <CAB7nPqRu07Ot6iht9i9KRfYLpDaF2ZuUv5y_+72uP23ZAGysRg(at)mail(dot)gmail(dot)com>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/052cc223d5ce1b727f62afff75797c88d82f880b

Modified Files
--------------
contrib/pg_standby/pg_standby.c | 2 +-
contrib/vacuumlo/vacuumlo.c | 8 ++---
src/backend/bootstrap/bootstrap.c | 14 +++-----
src/backend/port/dynloader/darwin.c | 3 ++
src/backend/utils/misc/ps_status.c | 27 +++++++++++++++
src/bin/pg_archivecleanup/pg_archivecleanup.c | 2 +-
src/bin/psql/command.c | 12 +++++--
src/common/exec.c | 9 +++--
src/test/isolation/isolationtester.c | 14 ++++----
src/test/isolation/specparse.y | 34 +++++++++----------
src/test/isolation/specscanner.l | 4 +--
src/test/regress/pg_regress.c | 48 +++++++++++++--------------
12 files changed, 108 insertions(+), 69 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message pgsql 2016-08-30 23:11:16 pgsql: Tag refs/tags/REL9_6_RC1 was created
Previous Message Tom Lane 2016-08-30 21:02:16 pgsql: Simplify correct use of simple_prompt().