1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Fix memory leak in IndexScan node with reordering

Fix ExecReScanIndexScan() to free the referenced tuples while emptying the
priority queue.  Backpatch to all supported versions.

Discussion: https://postgr.es/m/CAHqSB9gECMENBQmpbv5rvmT3HTaORmMK3Ukg73DsX5H7EJV7jw%40mail.gmail.com
Author: Aliaksandr Kalenik
Reviewed-by: Tom Lane, Alexander Korotkov
Backpatch-through: 10
This commit is contained in:
Alexander Korotkov
2022-02-14 03:26:55 +03:00
parent c963e84fb8
commit 3f74daa8df
3 changed files with 36 additions and 1 deletions

View File

@ -574,8 +574,12 @@ ExecReScanIndexScan(IndexScanState *node)
/* flush the reorder queue */
if (node->iss_ReorderQueue)
{
HeapTuple tuple;
while (!pairingheap_is_empty(node->iss_ReorderQueue))
reorderqueue_pop(node);
{
tuple = reorderqueue_pop(node);
heap_freetuple(tuple);
}
}
/* reset index scan */