Re: Memory leak fix in psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Japin Li <japinli(at)hotmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Memory leak fix in psql
Date: 2022-07-19 16:36:31
Message-ID: 1212323.1658248591@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2022-07-19 21:08:53 +0800, Japin Li wrote:
>> + {
>> + termPQExpBuffer(&buf);
>> return false;
>> + }

> Adding copy over copy of this same block doesn't seem great. Can we instead
> add a helper for it or such?

The usual style in these files is something like

if (bad things happened)
goto fail;

...

fail:
termPQExpBuffer(&buf);
return false;

Yeah, it's old school, but please let's not have a few functions that
do it randomly differently from all their neighbors.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-07-19 16:39:43 Re: [PATCH] Log details for client certificate failures
Previous Message Tom Lane 2022-07-19 16:31:08 Re: Convert planner's AggInfo and AggTransInfo to Nodes