Re: Change pfree to accept NULL argument

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-08-28T08:00:34Z
Lists: pgsql-hackers
On 22.08.22 20:30, Tom Lane wrote:
> I'm not very convinced that the benefits of making pfree() more
> like free() are worth those costs.
> 
> We could ameliorate the first objection if we wanted to back-patch
> 0002, I guess.
> 
> (FWIW, no objection to your 0001.  0004 and 0005 seem okay too;
> they don't touch enough places to create much back-patching risk.)

To conclude this, I have committed those secondary patches and updated 
the utils/mmgr/README with some information from this discussion.



Commits

  1. Add more detail why repalloc and pfree do not accept NULL pointers

  2. Remove unneeded null pointer checks before PQfreemem()

  3. Remove unnecessary casts in free() and pfree()