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: Michael Paquier <michael@paquier.xyz>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-06-18T03:45:53Z
Lists: pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes: > On Fri, Jun 17, 2022 at 09:03:23PM +0200, Peter Eisentraut wrote: >> I'm pretty sure PostgreSQL code already depends on this behavior anyway. >> The code just isn't consistent about it. > In the frontend, I'd like to think that you are right and that we have > already some places doing that. We do, indeed. > The backend is a different story, > like in GetMemoryChunkContext(). That should be easy enough to check > with some LD_PRELOAD wizardry, at least. Huh? The proposal is to accept the fact that free() tolerates NULL, and then maybe make pfree() tolerate it as well. I don't think that that needs to encompass any other functions. regards, tom lane
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