aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-04-15 00:02:26 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-04-15 00:02:26 -0400
commitedd57377f0db00a66d39029aa5239a96280887ef (patch)
treec9ea7dd627d9010d4e6a62e00784904a56bafcf0
parent593f469a048f1479d19579a06ec32cce9ddfa190 (diff)
downloadpostgresql-edd57377f0db00a66d39029aa5239a96280887ef.tar.gz
postgresql-edd57377f0db00a66d39029aa5239a96280887ef.zip
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
-rw-r--r--src/backend/access/gin/ginget.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index ee2eb633468..dcca7f4268f 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);
}
/*