Re: [bug fix] Memory leak in dblink - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [bug fix] Memory leak in dblink
Date
Msg-id 12576.1403149350@sss.pgh.pa.us
Whole thread Raw
In response to Re: [bug fix] Memory leak in dblink  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Joe Conway <mail@joeconway.com> writes:
> On 06/18/2014 08:19 PM, Tom Lane wrote:
>> Actually, I was wondering whether we couldn't remove that 
>> CreateTupleDescCopy call entirely.

> Apparently not, at least without some additional surgery.
> ExecMakeTableFunctionResult() tries to free the tupledesc and segfaults.

Hmm ... oh, I missed this bit:
           /* We must get the tupledesc from call context */           if (rsinfo && IsA(rsinfo, ReturnSetInfo) &&
        rsinfo->expectedDesc != NULL)           {               result = TYPEFUNC_COMPOSITE;               if
(resultTupleDesc)                  *resultTupleDesc = rsinfo->expectedDesc;               /* Assume no polymorphic
columnshere, either */           }
 

So it's passing back the same tupdesc passed in by the caller of
ExecMakeTableFunctionResult.  We can free that all right, but the caller
won't be happy :-(
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Possible index issue on 9.5 slave
Next
From: Peter Geoghegan
Date:
Subject: Re: Possible index issue on 9.5 slave