Re: libpq: Remove redundant null pointer checks before free() - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: libpq: Remove redundant null pointer checks before free()
Date
Msg-id 5eb1b215-acc2-9922-50d8-fc57a3e4f5e8@enterprisedb.com
Whole thread Raw
In response to Re: libpq: Remove redundant null pointer checks before free()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: libpq: Remove redundant null pointer checks before free()  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: libpq: Remove redundant null pointer checks before free()  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
On 17.06.22 07:11, Tom Lane wrote:
> Having said that, the pattern "if (x) free(x);" is absolutely
> ubiquitous across our code, and so I'm not sure that I'm on
> board with undoing it only in libpq.  I'd be happier if we made
> a push to get rid of it everywhere.

Sure, here is a more comprehensive patch set.  (It still looks like 
libpq is the largest chunk.)

> 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().
Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: libpq: Remove redundant null pointer checks before free()
Next
From: Peter Eisentraut
Date:
Subject: Re: SGML doc file references