pgsql: amcheck: Fix memory leak with gin_index_check()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: amcheck: Fix memory leak with gin_index_check()
Date: 2026-07-06 00:32:46
Message-ID: E1wgXGR-001Vjk-0D@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

amcheck: Fix memory leak with gin_index_check()

"prev_tuple" was overwritten with a new tuple coming from
CopyIndexTuple() on each loop, leaking memory for every tuple processed
on entry tree pages. The function uses a dedicated memory context, but
this could leave unused large areas of memory while processing a large
GIN index, the larger the worse.

Oversight in 14ffaece0fb5.

Author: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Reviewed-by: Ewan Young <kdbase(dot)hack(at)gmail(dot)com>
Discussion: https://postgr.es/m/CALdSSPjTS6TYe5=5NfMUBYZyQu5cn=ABL6K5_OZjzGWqnwXeBw@mail.gmail.com
Backpatch-through: 18

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/80cfd8aef645295aceafd2aa98912c64edd06394

Modified Files
--------------
contrib/amcheck/verify_gin.c | 3 +++
1 file changed, 3 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-07-06 00:48:36 pgsql: Restore basebackup_progress_done() to preserve ABI
Previous Message Tom Lane 2026-07-05 22:11:54 pgsql: Fix psql's pager selection for wrapped expanded output.