Re: Avoid use scoped block variable - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Avoid use scoped block variable
Date
Msg-id dups3vodgn3ko6w7oi3rviehpl5462rvkspredynw7niaqc2ka@725gziq7647y
Whole thread Raw
In response to Avoid use scoped block variable  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: Avoid use scoped block variable
List pgsql-hackers
Hi,

On 2025-12-09 13:06:35 -0300, Ranier Vilela wrote:
> I noticed a possible violation of C rules.
> Some functions rely on local block variables,
> but this are a mistake.
> Once that block exits, the memory of the variable is released.

CStringGetTextDatum() copies its input to a fresh allocation. So there's no
longer-lived references to the local memory, unless I miss something?

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: Avoid use scoped block variable
Next
From: Tomas Vondra
Date:
Subject: Re: Avoid use scoped block variable