Change pfree to accept NULL argument
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-08-22T18:16:56Z
Lists: pgsql-hackers
Attachments
- 0001-Remove-unnecessary-casts-in-free-and-pfree.patch (text/plain) patch 0001
- 0002-Change-pfree-to-accept-NULL-argument.patch (text/plain) patch 0002
- 0003-Remove-no-longer-needed-null-pointer-checks-before-p.patch (text/plain) patch 0003
- 0004-Remove-unneeded-null-pointer-checks-before-PQfreemem.patch (text/plain) patch 0004
- 0005-Remove-unneeded-null-pointer-check-before-FreeDir.patch (text/plain) patch 0005
Per discussion in [0], here is a patch set that allows pfree() to accept a NULL argument, like free() does. Also, a patch that removes the now-unnecessary null pointer checks before calling pfree(). And a few patches that do the same for some other functions that I found around. (The one with FreeDir() is perhaps a bit arguable, since FreeDir() wraps closedir() which does *not* accept NULL arguments. Also, neither FreeFile() nor the underlying fclose() accept NULL.) [0]: https://www.postgresql.org/message-id/1074830.1655442689@sss.pgh.pa.us
Commits
-
Add more detail why repalloc and pfree do not accept NULL pointers
- 805a397db40b 16.0 landed
-
Remove unneeded null pointer checks before PQfreemem()
- e890ce7a4feb 16.0 landed
-
Remove unnecessary casts in free() and pfree()
- 45987aae260a 16.0 landed