Re: Memory leak fix in psql - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Memory leak fix in psql
Date
Msg-id 1212323.1658248591@sss.pgh.pa.us
Whole thread Raw
In response to Re: Memory leak fix in psql  (Andres Freund <andres@anarazel.de>)
Responses Re: Memory leak fix in psql  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Andres Freund <andres@anarazel.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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Convert planner's AggInfo and AggTransInfo to Nodes
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] Log details for client certificate failures