Re: Avoid use scoped block variable

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Re: Avoid use scoped block variable
Дата
Msg-id CAEudQAqepMe2cja=vPAJkzqE1To=yN6To0vqSzOdiCu9X+KWkQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Avoid use scoped block variable  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Em ter., 9 de dez. de 2025 às 13:19, Andres Freund <andres@anarazel.de> escreveu:
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?
Yeah. My bad.
cstring_to_text use palloc.

Sorry for the noise.

best regards,
Ranier Vilela

В списке pgsql-hackers по дате отправления: