Re: Patch a potential memory leak in describeOneTableDetails() - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Patch a potential memory leak in describeOneTableDetails()
Date
Msg-id F4F3D3F5-16A9-49F2-BB33-D8DAC6061742@yesql.se
Whole thread Raw
In response to Re: Patch a potential memory leak in describeOneTableDetails()  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: Patch a potential memory leak in describeOneTableDetails()  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers
> On 21 Feb 2022, at 09:30, Kyotaro Horiguchi <horikyota.ntt@gmail.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/




pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Design of pg_stat_subscription_workers vs pgstats
Next
From: "osumi.takamichi@fujitsu.com"
Date:
Subject: RE: Failed transaction statistics to measure the logical replication progress