diff options
-rw-r--r-- | doc/src/sgml/indexam.sgml | 3 | ||||
-rw-r--r-- | src/backend/access/spgist/spgscan.c | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml index 40f201b11be..a613ae7ddc0 100644 --- a/doc/src/sgml/indexam.sgml +++ b/doc/src/sgml/indexam.sgml @@ -591,7 +591,8 @@ amendscan (IndexScanDesc scan); </programlisting> End a scan and release resources. The <literal>scan</> struct itself should not be freed, but any locks or pins taken internally by the - access method must be released. + access method must be released, as well as any other memory allocated + by <function>ambeginscan</function> and other scan-related functions. </para> <para> diff --git a/src/backend/access/spgist/spgscan.c b/src/backend/access/spgist/spgscan.c index 1e476681ea6..3fe77831d1b 100644 --- a/src/backend/access/spgist/spgscan.c +++ b/src/backend/access/spgist/spgscan.c @@ -240,6 +240,14 @@ spgendscan(IndexScanDesc scan) MemoryContextDelete(so->tempCxt); MemoryContextDelete(so->traversalCxt); + + if (so->keyData) + pfree(so->keyData); + + if (so->state.deadTupleStorage) + pfree(so->state.deadTupleStorage); + + pfree(so); } /* |