Re: replace strtok()
От
Peter Eisentraut
Тема
Re: replace strtok()
Дата
Msg-id
00ebf832-0f69-4562-aa1c-b5266f578dc6@eisentraut.org
Список
Дерево обсуждения
replace strtok() Peter Eisentraut <peter@eisentraut.org>
Re: replace strtok() Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: replace strtok() Ranier Vilela <ranier.vf@gmail.com>
Re: replace strtok() Peter Eisentraut <peter@eisentraut.org>
Re: replace strtok() Tom Lane <tgl@sss.pgh.pa.us>
Re: replace strtok() Michael Paquier <michael@paquier.xyz>
Re: replace strtok() Peter Eisentraut <peter@eisentraut.org>
Re: replace strtok() David Steele <david@pgmasters.net>
Re: replace strtok() Peter Eisentraut <peter@eisentraut.org>
Re: replace strtok() Alexander Lakhin <exclusion@gmail.com>
On 16.10.24 09:42, Peter Eisentraut wrote:
> On 15.10.24 14:00, Alexander Lakhin wrote:
>> I also wonder, if other places touched by 5d2e1cc11 need corrections too.
>> I played with
>> PG_COLOR=always PG_COLORS="error=01;31" .../initdb
>>
>> and it looks like this free() call in pg_logging_init():
>> char *colors = strdup(pg_colors_env);
>>
>> if (colors)
>> {
>> ...
>> while ((token = strsep(&colors, ":")))
>> {
>> ...
>> }
>>
>> free(colors);
>> }
>> gets null in colors.
>
> Yes, this is indeed incorrect. We need to keep a separate pointer to
> the start of the string to free later. This matches the example on the
> strsep man page (https://man.freebsd.org/cgi/man.cgi?strsep(3)). Patch
> attached.
I have committed both fixes mentioned in this thread in the last couple
of days.
В списке pgsql-hackers по дате отправления
От: Amit Kapila
Дата: