Re: replace strtok()

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: replace strtok()
Date: 2024-10-18 11:11:18
Message-ID: CAEudQApk3Knu5sE92HtbqSiWJx=mHGts1NCOZkVHQ4txexnfOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em sex., 18 de out. de 2024 às 06:41, Peter Eisentraut <peter(at)eisentraut(dot)org>
escreveu:

> 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.
>
Thanks.

Thanks Alexander, for the hard work.

best regards,
Ranier Vilela

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2024-10-18 11:38:29 Re: [PoC] Federated Authn/z with OAUTHBEARER
Previous Message Zhijie Hou (Fujitsu) 2024-10-18 10:59:56 RE: Conflict Detection and Resolution