Re: libpq: Remove redundant null pointer checks before free()

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Michael Paquier <michael@paquier.xyz>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-06-17T19:31:58Z
Lists: pgsql-hackers
Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> On 17.06.22 07:11, Tom Lane wrote:
>> Notably, I think the choice
>> that pfree(NULL) is disallowed traces directly to worries about
>> coding-pattern-compatibility with pre-POSIX free().  Should we
>> revisit that?

> Yes please, and also repalloc().

repalloc no, because you wouldn't know which context to do the
allocation in.

			regards, tom lane



Commits

  1. Remove redundant null pointer checks before PQclear and PQconninfoFree

  2. Remove redundant null pointer checks before free()

  3. Remove redundant null pointer checks before pg_free()