Re: Fix memory leak in gist_page_items() of pageinspect

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix memory leak in gist_page_items() of pageinspect
Date: 2025-12-17 11:57:13
Message-ID: aUKamYGiDKO6byp5@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, Dec 15, 2025 at 01:08:44PM +0900, Michael Paquier wrote:
> While passing through, I have applied 0001.

Out of curiosity, I searched for other mismatched index_open/relation_close pairs
in the tree and found a few more with the help of [1].

They are fixed in the attached.

Please note that for hash_bitmap_info() and pgstathashindex() the open calls are
changed instead. For those we keep the IS_INDEX() checks to reject partitioned
indexes (which index_open() accepts via validate_relation_kind()). So, that also
changes the error messages in some tests. If we do prefer the previous error
messages we could change the close calls instead (I prefer the way it's done
in the attached though).

Thoughts?

[1]: https://github.com/bdrouvot/coccinelle_on_pg/blob/main/misc/mismatched_open_close_pairs.cocci

Regards,

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

Attachment Content-Type Size
v1-0001-Fix-mismatched-index_open-relation_close-pairs.patch text/x-diff 6.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2025-12-17 12:04:15 Re: DOCS - Clarify the publication 'publish_via_partition_root' default value.
Previous Message Christoph Berg 2025-12-17 11:57:01 Re: pgsql: Revert "Avoid requiring Spanish locale to test NLS infrastructur