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 1c09bae3955..ef015d48c9e 100644 --- a/doc/src/sgml/indexam.sgml +++ b/doc/src/sgml/indexam.sgml @@ -456,7 +456,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 8a0d9098c5e..0a7a46364ab 100644 --- a/src/backend/access/spgist/spgscan.c +++ b/src/backend/access/spgist/spgscan.c @@ -236,6 +236,14 @@ spgendscan(PG_FUNCTION_ARGS) MemoryContextDelete(so->tempCxt); + if (so->keyData) + pfree(so->keyData); + + if (so->state.deadTupleStorage) + pfree(so->state.deadTupleStorage); + + pfree(so); + PG_RETURN_VOID(); } |