Re: Patch a potential memory leak in describeOneTableDetails()

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: wliang(at)stu(dot)xidian(dot)edu(dot)cn, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Patch a potential memory leak in describeOneTableDetails()
Date: 2022-02-21 09:24:23
Message-ID: F4F3D3F5-16A9-49F2-BB33-D8DAC6061742@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 21 Feb 2022, at 09:30, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> 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 (tableinfo.relam)
>> ^~
>> describe.c:3423:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
>> if (res)
> ^~

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:

> + if (tableinfo.relam)
> + pg_free(tableinfo.relam);
>
> if (res)
> PQclear(res);

--
Daniel Gustafsson https://vmware.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message osumi.takamichi@fujitsu.com 2022-02-21 10:06:17 RE: Failed transaction statistics to measure the logical replication progress
Previous Message Amit Kapila 2022-02-21 09:19:01 Re: Design of pg_stat_subscription_workers vs pgstats