mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-08 19:29:24 +02:00
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@telsasoft.com> Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/20201105203606.GF22691@telsasoft.com
This commit is contained in:
parent
6a7b55f371
commit
d94d37f8c0
@ -170,13 +170,14 @@ index_get_partition(Relation partition, Oid indexId)
|
|||||||
ReleaseSysCache(tup);
|
ReleaseSysCache(tup);
|
||||||
if (!ispartition)
|
if (!ispartition)
|
||||||
continue;
|
continue;
|
||||||
if (get_partition_parent(lfirst_oid(l)) == indexId)
|
if (get_partition_parent(partIdx) == indexId)
|
||||||
{
|
{
|
||||||
list_free(idxlist);
|
list_free(idxlist);
|
||||||
return partIdx;
|
return partIdx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_free(idxlist);
|
||||||
return InvalidOid;
|
return InvalidOid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user