public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: Jacob Champion <[email protected]>
To: Andres Freund <[email protected]>
Cc: Andreas Karlsson <[email protected]>
Cc: Галкин Сергей <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: DEREF_AFTER_NULL: src/common/jsonapi.c:2529
Date: Wed, 8 Apr 2026 23:25:02 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAOYmi+k__DbMjOxfySjVjCQB=-7Pd+qHb-1Vn9kuN1XOgbOsGg@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CAOYmi+muy=Wtk0dv6J5HmcFTMvrPMe2MGN2X+hjZL7DKSUEXLQ@mail.gmail.com>
	<leyiwkml7kyrdxwjzhcmmi6rtyxxwofokfxhlkpbagfprmbqw2@jxdckvomcmug>
	<CAOYmi+mneT-m52GhWdA=XqH5SE6f5jJbAmjwL+wp+xk4j9VVpg@mail.gmail.com>
	<mazv3o3ua5pbvy5xwrz6n6zu6gyxkqtohbdohu3o73xyhtwa26@xcbb7ro2o42k>
	<CAOYmi+k__DbMjOxfySjVjCQB=-7Pd+qHb-1Vn9kuN1XOgbOsGg@mail.gmail.com>

On 07.04.26 00:01, Jacob Champion wrote:
>>> Or else make pfree() behave like free() [2] so that we don't
>>> have to have that particular papercut at all anymore?
>>
>> -many
>>
>> It's also not a path I want to add any unnecessary instructions to.
> 
> Okay, but I'd be curious to know how widespread this position is.

This was recently (as in: I still remember it) discussed:

https://www.postgresql.org/message-id/flat/cf26e970-8e92-59f1-247a-aa265235075b%40enterprisedb.com

Probably not worth opening up again.

But it seems to me that the pfree() in fe_memutils.c should 
Assert(pointer != NULL), to be consistent with the backend version.

I've also been thinking sometimes about a pfree_if_nonnull() (which 
would do { if (ptr) pfree(ptr)) }.  That would in some cases make the 
notation more compact and robust.  Maybe it could help here too?






view thread (10+ messages)  latest in thread

reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: DEREF_AFTER_NULL: src/common/jsonapi.c:2529
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox