Re: Fix memory leak in gist_page_items() of pageinspect

2025-12-12 Thread Daniel Gustafsson
> On 12 Dec 2025, at 11:27, Heikki Linnakangas wrote: > If we're going to bother changing this at all, let's consider reusing the > buffer. So instead of initStringInfo()+pfree on every tuple, allocate it once > and use resetStringInfo(). +1 -- Daniel Gustafsson

Re: Fix memory leak in gist_page_items() of pageinspect

2025-12-12 Thread Heikki Linnakangas
On 12/12/2025 11:48, Michael Paquier wrote: On Fri, Dec 12, 2025 at 09:00:08AM +, 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

Re: Fix memory leak in gist_page_items() of pageinspect

2025-12-12 Thread Bertrand Drouvot
Hi, On Fri, Dec 12, 2025 at 06:48:09PM +0900, Michael Paquier wrote: > On Fri, Dec 12, 2025 at 09:00:08AM +, 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

Re: Fix memory leak in gist_page_items() of pageinspect

2025-12-12 Thread Michael Paquier
On Fri, Dec 12, 2025 at 09:00:08AM +, 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

Re: Fix memory leak in gist_page_items() of pageinspect

2025-12-12 Thread Bertrand Drouvot
Hi, On Fri, Dec 12, 2025 at 04:50:09PM +0800, Chao Li wrote: > Hi Hackers, > > While reading the code of pageinspect, I just found a memory leak > in gist_page_items(): > > ``` >values[4] = CStringGetTextDatum(buf.data); >nulls[4] = false; > ``` > > where CStringGetTextDatum() has made

Fix memory leak in gist_page_items() of pageinspect

2025-12-12 Thread Chao Li
Hi Hackers, While reading the code of pageinspect, I just found a memory leak in gist_page_items(): ``` values[4] = CStringGetTextDatum(buf.data); nulls[4] = false; ``` where CStringGetTextDatum() has made a copy of buf.data and assigned to value[4], however buf.data is never free-ed. This