re: Change pfree to accept NULL argument

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: re: Change pfree to accept NULL argument
Date: 2022-08-22 19:15:23
Message-ID: CAEudQArevG-VO+x2eyk12UUnY192nBdBnwFrcXNyER1FasxChw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Hi Peter,

+1

However, after a quick review, I noticed some cases of PQ freemen missing.
I took the liberty of making a v1, attached.

regards,

Ranier Vilela

Attachment Content-Type Size
v1-0004-Remove-unneeded-null-pointer-checks-before-PQfreemem.patch application/octet-stream 3.2 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikita Malakhov 2022-08-22 19:41:33 Re: [PATCH] ALTER TABLE ... SET STORAGE default
Previous Message Pavel Stehule 2022-08-22 19:13:39 Re: Schema variables - new implementation for Postgres 15