pgsql: Plug memory leak in index_get_partition

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Plug memory leak in index_get_partition
Date: 2020-11-07 01:53:14
Message-ID: E1kbDPm-0007GH-E6@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Plug memory leak in index_get_partition

The list of indexes was being leaked when asked for an index that
doesn't have an index partition in the table partition. Not a common
case admittedly --and in most cases where it occurs, caller throws an
error anyway-- but worth fixing for cleanliness and in case any
third-party code is calling this function.

While at it, remove use of lfirst_oid() to obtain a value we already
have.

Author: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Discussion: https://postgr.es/m/20201105203606.GF22691@telsasoft.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d94d37f8c0c77cf1b9c5ae924bb6cfc12f4bc692

Modified Files
--------------
src/backend/catalog/partition.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2020-11-07 11:32:24 pgsql: Move catalog index declarations
Previous Message Michael Paquier 2020-11-07 01:46:30 pgsql: Add GUC_LIST_INPUT and GUC_LIST_QUOTE to unix_socket_directories