Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5d7e44f

Browse files
committed
Fix memory overhelding while forming index' result:
memory allocation for ItemPointerData of heap' tuple is useless because of FormRetrieveIndexResult makes neccessary palloc.
1 parent 05b3b86 commit 5d7e44f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/backend/access/hash/hashsearch.c

+3-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.7 1996/11/05 09:40:23 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.8 1996/11/21 06:06:52 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -74,7 +74,6 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
7474
OffsetNumber offnum;
7575
RetrieveIndexResult res;
7676
ItemPointer current;
77-
ItemPointer iptr;
7877
HashItem hitem;
7978
IndexTuple itup;
8079
HashScanOpaque so;
@@ -116,9 +115,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
116115
_hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
117116
hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum));
118117
itup = &hitem->hash_itup;
119-
iptr = (ItemPointer) palloc(sizeof(ItemPointerData));
120-
memmove((char *) iptr, (char *) &(itup->t_tid), sizeof(ItemPointerData));
121-
res = FormRetrieveIndexResult(current, iptr);
118+
res = FormRetrieveIndexResult(current, &(itup->t_tid));
122119

123120
return (res);
124121
}
@@ -184,7 +181,6 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
184181
HashItem hitem;
185182
IndexTuple itup;
186183
ItemPointer current;
187-
ItemPointer iptr;
188184
OffsetNumber offnum;
189185
RetrieveIndexResult res;
190186
HashScanOpaque so;
@@ -245,9 +241,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
245241
_hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
246242
hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum));
247243
itup = &hitem->hash_itup;
248-
iptr = (ItemPointer) palloc(sizeof(ItemPointerData));
249-
memmove((char *) iptr, (char *) &(itup->t_tid), sizeof(ItemPointerData));
250-
res = FormRetrieveIndexResult(current, iptr);
244+
res = FormRetrieveIndexResult(current, &(itup->t_tid));
251245

252246
return (res);
253247
}

0 commit comments

Comments
 (0)