Re: Uncleared result sets in describeOneTableDetails() - Mailing list pgsql-hackers

From Brendan Jurd
Subject Re: Uncleared result sets in describeOneTableDetails()
Date
Msg-id 37ed240d0611062256t2f3e6d8aka79fd9b0e05b6cde@mail.gmail.com
Whole thread Raw
In response to Re: Uncleared result sets in describeOneTableDetails()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Uncleared result sets in describeOneTableDetails()  (Neil Conway <neilc@samurai.com>)
Re: Uncleared result sets in describeOneTableDetails()  (Neil Conway <neilc@samurai.com>)
List pgsql-hackers
On 11/7/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Brendan Jurd" <direvus@gmail.com> writes:
> > Is it crucial that result sets be cleared before going out of scope?
>
> It sounds like it'd leak memory inside psql; but realistically that's
> probably not an enormous problem for this usage.  How much uglification
> of the code are we talking about to fix it?
>

Should be just six extra lines (patch attached, untested).  This isn't
really an uglification of the code, so much as bringing this
particular code segment into line with the existing ugliness standard
of the rest of the function. =)

It certainly isn't pretty.  It's been a long time since I looked down
the barrel of a 'goto'.  This sort of thing feels like it should be
dealt with by RAII or try/catch, but this is C we're talking about.
It's hard to do things gracefully.

Regards,
BJ

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Uncleared result sets in describeOneTableDetails()
Next
From: "Heikki Linnakangas"
Date:
Subject: Block B-tree etc. (was Re: Introducing an advanced Frequent Update)