postgres.git / summary / log / commit / refs
commit 0479eccdcf0db59336aa45c6501666cd9f590b6a
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Fri Apr 15 04:02:26 2016 +0000
First released in: 9.6.0, 9.4.8, 9.5.3
Fix memory leak in GIN index scans.
The code had a query-lifespan memory leak when encountering GIN entries
that have posting lists (rather than posting trees, ie, there are a
relatively small number of heap tuples containing this index key value).
With a suitable data distribution this could add up to a lot of leakage.
Problem seems to have been introduced by commit 36a35c550, so back-patch
to 9.4.
Julien Rouhaud
src/backend/access/gin/ginget.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index 96c1cb971e4..bde5d2bd163 100644
--- a/src/backend/access/gin/ginget.c
+++ b/src/backend/access/gin/ginget.c
@@ -278,6 +278,7 @@ collectMatchBitmap(GinBtreeData *btree, GinBtreeStack *stack,
ipd = ginReadTuple(btree->ginstate, scanEntry->attnum, itup, &nipd);
tbm_add_tuples(scanEntry->matchBitmap, ipd, nipd, false);
scanEntry->predictNumberResult += GinGetNPosting(itup);
+ pfree(ipd);
}
/*
[parent: 00456911f43a]