Re: libpq: Remove redundant null pointer checks before free()
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>, Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-06-17T19:07:58Z
Lists: pgsql-hackers
Attachments
- v2-0001-Remove-redundant-null-pointer-checks-before-free.patch (text/plain) patch v2-0001
- v2-0002-Remove-redundant-null-pointer-checks-before-pg_fr.patch (text/plain) patch v2-0002
- v2-0003-Remove-redundant-null-pointer-checks-before-PQcle.patch (text/plain) patch v2-0003
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().
Commits
-
Remove redundant null pointer checks before PQclear and PQconninfoFree
- 5faef9d58201 16.0 landed
-
Remove redundant null pointer checks before free()
- 02c408e21a6e 16.0 landed
-
Remove redundant null pointer checks before pg_free()
- 098c703d308f 16.0 landed