mirror of
https://github.com/postgres/postgres.git
synced 2025-08-05 07:41:25 +03:00
Fix memory overhelding while forming index' result:
memory allocation for ItemPointerData of heap' tuple is useless because of FormRetrieveIndexResult makes neccessary palloc.
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.7 1996/11/05 09:40:23 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.8 1996/11/21 06:06:52 vadim Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@@ -74,7 +74,6 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
|
|||||||
OffsetNumber offnum;
|
OffsetNumber offnum;
|
||||||
RetrieveIndexResult res;
|
RetrieveIndexResult res;
|
||||||
ItemPointer current;
|
ItemPointer current;
|
||||||
ItemPointer iptr;
|
|
||||||
HashItem hitem;
|
HashItem hitem;
|
||||||
IndexTuple itup;
|
IndexTuple itup;
|
||||||
HashScanOpaque so;
|
HashScanOpaque so;
|
||||||
@@ -116,9 +115,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
|
|||||||
_hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
|
_hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
|
||||||
hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum));
|
hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum));
|
||||||
itup = &hitem->hash_itup;
|
itup = &hitem->hash_itup;
|
||||||
iptr = (ItemPointer) palloc(sizeof(ItemPointerData));
|
res = FormRetrieveIndexResult(current, &(itup->t_tid));
|
||||||
memmove((char *) iptr, (char *) &(itup->t_tid), sizeof(ItemPointerData));
|
|
||||||
res = FormRetrieveIndexResult(current, iptr);
|
|
||||||
|
|
||||||
return (res);
|
return (res);
|
||||||
}
|
}
|
||||||
@@ -184,7 +181,6 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
|
|||||||
HashItem hitem;
|
HashItem hitem;
|
||||||
IndexTuple itup;
|
IndexTuple itup;
|
||||||
ItemPointer current;
|
ItemPointer current;
|
||||||
ItemPointer iptr;
|
|
||||||
OffsetNumber offnum;
|
OffsetNumber offnum;
|
||||||
RetrieveIndexResult res;
|
RetrieveIndexResult res;
|
||||||
HashScanOpaque so;
|
HashScanOpaque so;
|
||||||
@@ -245,9 +241,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
|
|||||||
_hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
|
_hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
|
||||||
hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum));
|
hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum));
|
||||||
itup = &hitem->hash_itup;
|
itup = &hitem->hash_itup;
|
||||||
iptr = (ItemPointer) palloc(sizeof(ItemPointerData));
|
res = FormRetrieveIndexResult(current, &(itup->t_tid));
|
||||||
memmove((char *) iptr, (char *) &(itup->t_tid), sizeof(ItemPointerData));
|
|
||||||
res = FormRetrieveIndexResult(current, iptr);
|
|
||||||
|
|
||||||
return (res);
|
return (res);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user