Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit30584cd

Browse files
committed
Fix small query-lifespan memory leak introduced by 8.4 change in index AM API
for bitmap index scans. Per report and test case from Kevin Grittner.
1 parent8fc4197 commit30584cd

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

‎src/backend/access/index/indexam.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.110 2008/09/11 14:01:09 alvherre Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.111 2008/10/10 14:17:08 tgl Exp $
1212
*
1313
* INTERFACE ROUTINES
1414
*index_open- open an index relation by relation OID
@@ -655,6 +655,7 @@ index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap)
655655
{
656656
FmgrInfo*procedure;
657657
int64ntids;
658+
Datumd;
658659

659660
SCAN_CHECKS;
660661
GET_SCAN_PROCEDURE(amgetbitmap);
@@ -665,9 +666,16 @@ index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap)
665666
/*
666667
* have the am's getbitmap proc do all the work.
667668
*/
668-
ntids=DatumGetInt64(FunctionCall2(procedure,
669-
PointerGetDatum(scan),
670-
PointerGetDatum(bitmap)));
669+
d=FunctionCall2(procedure,
670+
PointerGetDatum(scan),
671+
PointerGetDatum(bitmap));
672+
673+
ntids=DatumGetInt64(d);
674+
675+
/* If int8 is pass-by-ref, must free the result to avoid memory leak */
676+
#ifndefUSE_FLOAT8_BYVAL
677+
pfree(DatumGetPointer(d));
678+
#endif
671679

672680
pgstat_count_index_tuples(scan->indexRelation,ntids);
673681

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp