Re: Patch a potential memory leak in describeOneTableDetails()

2022-04-19 Thread Daniel Gustafsson
> On 24 Feb 2022, at 14:55, Daniel Gustafsson wrote: >> On 24 Feb 2022, at 07:32, Kyotaro Horiguchi wrote: >> So the attached does that. > > I think this is reasonable, since it's pretty clear that more(1) supporting > "-x" is fairly rare. I'll await others commenting. The original patch

Re: Patch a potential memory leak in describeOneTableDetails()

2022-02-24 Thread Daniel Gustafsson
> On 24 Feb 2022, at 07:32, Kyotaro Horiguchi wrote: > > At Thu, 24 Feb 2022 14:44:56 +0900 (JST), Kyotaro Horiguchi > wrote in >> At Tue, 22 Feb 2022 09:59:09 +0100, Daniel Gustafsson >> wrote in >>> The section in question was added to our docs 22 years ago, to make it >>> reflect >>>

Re: Patch a potential memory leak in describeOneTableDetails()

2022-02-23 Thread Kyotaro Horiguchi
At Thu, 24 Feb 2022 14:44:56 +0900 (JST), Kyotaro Horiguchi wrote in > At Tue, 22 Feb 2022 09:59:09 +0100, Daniel Gustafsson wrote > in > > The section in question was added to our docs 22 years ago, to make it > > reflect > > the current operating systems in use maybe just not mentioning

Re: Patch a potential memory leak in describeOneTableDetails()

2022-02-23 Thread Kyotaro Horiguchi
At Tue, 22 Feb 2022 09:59:09 +0100, Daniel Gustafsson wrote in > > On 22 Feb 2022, at 07:14, Kyotaro Horiguchi wrote: > > > Anyway, don't we use the -ftabstop option flag to silence compiler? > > The warning is contradicting our convention. The attached adds that > > flag. > > Isn't this

Re: Patch a potential memory leak in describeOneTableDetails()

2022-02-22 Thread Tom Lane
Kyotaro Horiguchi writes: > Anyway, don't we use the -ftabstop option flag to silence compiler? > The warning is contradicting our convention. The attached adds that > flag. No, we use pgindent to not have such inconsistent indentation. regards, tom lane

Re: Patch a potential memory leak in describeOneTableDetails()

2022-02-22 Thread Daniel Gustafsson
> On 22 Feb 2022, at 07:14, Kyotaro Horiguchi wrote: > Anyway, don't we use the -ftabstop option flag to silence compiler? > The warning is contradicting our convention. The attached adds that > flag. Isn't this flag contradicting our convention? From the docs section you reference further

Re: Patch a potential memory leak in describeOneTableDetails()

2022-02-21 Thread Kyotaro Horiguchi
At Mon, 21 Feb 2022 10:24:23 +0100, Daniel Gustafsson wrote in > I think it's because you've indented your new code differently from the > existing, such that the if (res) clause is indented equally to the previous > pg_free(tableinfo.relam) call, making it look like they are in the same block:

Re: Patch a potential memory leak in describeOneTableDetails()

2022-02-21 Thread Daniel Gustafsson
> On 21 Feb 2022, at 09:30, Kyotaro Horiguchi wrote: > (However, I got a mysterious -Wmisleading-indentation warning with this..) > >> describe.c: In function ‘describeOneTableDetails’: >> describe.c:3420:5: warning: this ‘if’ clause does not guard... >> [-Wmisleading-indentation] >> if

Re: Patch a potential memory leak in describeOneTableDetails()

2022-02-21 Thread Kyotaro Horiguchi
At Fri, 18 Feb 2022 16:12:34 +0800 (GMT+08:00), wli...@stu.xidian.edu.cn wrote in > I find a potential memory leak in PostgresSQL 14.1, which is in the function > describeOneTableDetails (./src/bin/psql/describe.c). The bug has been > confirmed by an auditor of . > > Specifically, at line

Patch a potential memory leak in describeOneTableDetails()

2022-02-18 Thread wliang
Hi all, I find a potential memory leak in PostgresSQL 14.1, which is in the function describeOneTableDetails (./src/bin/psql/describe.c). The bug has been confirmed by an auditor of . Specifically, at line 1603, a memory chunk is allocated with pg_strdup and assigned to