diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c index a6756d594d..53290a4279 100644 --- a/src/backend/access/gin/ginget.c +++ b/src/backend/access/gin/ginget.c @@ -302,6 +302,8 @@ restartScanEntry: entry->buffer = InvalidBuffer; ItemPointerSetMin(&entry->curItem); entry->offset = InvalidOffsetNumber; + if (entry->list) + pfree(entry->list); entry->list = NULL; entry->nlist = 0; entry->matchBitmap = NULL; diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/ginscan.c index 3449a30e41..c449c1cbc0 100644 --- a/src/backend/access/gin/ginscan.c +++ b/src/backend/access/gin/ginscan.c @@ -246,6 +246,8 @@ ginFreeScanKeys(GinScanOpaque so) if (entry->buffer != InvalidBuffer) ReleaseBuffer(entry->buffer); + if (entry->list) + pfree(entry->list); if (entry->matchIterator) tbm_end_iterate(entry->matchIterator); if (entry->matchBitmap) @@ -285,7 +287,7 @@ ginNewScanKey(IndexScanDesc scan) so->totalentries = 0; so->allocentries = 32; so->entries = (GinScanEntry *) - palloc0(so->allocentries * sizeof(GinScanEntry)); + palloc(so->allocentries * sizeof(GinScanEntry)); so->isVoidRes = false;