Re: Fix memory leak in gist_page_items() of pageinspect - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Fix memory leak in gist_page_items() of pageinspect
Date
Msg-id aTvtNLhiFGBNzl7x@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: Fix memory leak in gist_page_items() of pageinspect  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Hi,

On Fri, Dec 12, 2025 at 06:48:09PM +0900, Michael Paquier wrote:
> On Fri, Dec 12, 2025 at 09:00:08AM +0000, Bertrand Drouvot wrote:
> > On Fri, Dec 12, 2025 at 04:50:09PM +0800, Chao Li wrote:
> >> where CStringGetTextDatum() has made a copy of buf.data and assigned to
> >> value[4], however buf.data is never free-ed.
> > 
> > I did not look in details but I think that we should be in a short lived
> > memory context here so we generally prefer to avoid using pfree for those cases.
> 
> The only thing that does a memory allocation is the StringInfo, why
> would a memory context be worth the complication here?

I meant to say: we are probably already in a short lived memory context. I did
not mean to say to switch to a new one.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY
Next
From: Heikki Linnakangas
Date:
Subject: Re: Fix memory leak in gist_page_items() of pageinspect