From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: libpq: Remove redundant null pointer checks before free()
Date: Fri, 17 Jun 2022 23:45:53 -0400
Message-ID: <1477430.1655523953@sss.pgh.pa.us> (raw)
In-Reply-To: <Yq1Drw2Ufo1GUVKy@paquier.xyz>
References: <dac5d2d0-98f5-94d9-8e69-46da2413593d@enterprisedb.com>
<Yqv0E7iIUfv4cpp2@paquier.xyz>
<5333caf7-7667-bc58-0fd0-2e82eaf01967@enterprisedb.com>
<Yq1Drw2Ufo1GUVKy@paquier.xyz>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, michael@paquier.xyz, peter.eisentraut@enterprisedb.com
Subject: Re: libpq: Remove redundant null pointer checks before free()
In-Reply-To: <1477430.1655523953@sss.pgh.pa.us>
References: <dac5d2d0-98f5-94d9-8e69-46da2413593d@enterprisedb.com> <Yqv0E7iIUfv4cpp2@paquier.xyz> <5333caf7-7667-bc58-0fd0-2e82eaf01967@enterprisedb.com> <Yq1Drw2Ufo1GUVKy@paquier.xyz> <1477430.1655523953@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox