Content-Length: 278558 | pFad | http://github.com/postgrespro/postgres_cluster/commit/fa19a08d71fbeefc39415d9c6c70128460d41f94

44 Fix variable initialization when using buffering build with GiST · postgrespro/postgres_cluster@fa19a08 · GitHub
Skip to content

Commit fa19a08

Browse files
committed
Fix variable initialization when using buffering build with GiST
This can cause valgrind to complain, as the flag marking a buffer as a temporary copy was not getting initialized. While on it, fill in with zeros newly-created buffer pages. This does not matter when loading a block from a temporary file, but it makes the push of an index tuple into a new buffer page safer. This has been introduced by 1d27dcf, so backpatch all the way down to 9.4. Author: Alexander Lakhin Discussion: https://postgr.es/m/15899-0d24fb273b3dd90c@postgresql.org Backpatch-through: 9.4
1 parent 5a7d697 commit fa19a08

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/access/gist/gistbuildbuffers.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ gistGetNodeBuffer(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
138138
nodeBuffer->pageBlocknum = InvalidBlockNumber;
139139
nodeBuffer->pageBuffer = NULL;
140140
nodeBuffer->queuedForEmptying = false;
141+
nodeBuffer->isTemp = false;
141142
nodeBuffer->level = level;
142143

143144
/*
@@ -186,8 +187,8 @@ gistAllocateNewPageBuffer(GISTBuildBuffers *gfbb)
186187
{
187188
GISTNodeBufferPage *pageBuffer;
188189

189-
pageBuffer = (GISTNodeBufferPage *) MemoryContextAlloc(gfbb->context,
190-
BLCKSZ);
190+
pageBuffer = (GISTNodeBufferPage *) MemoryContextAllocZero(gfbb->context,
191+
BLCKSZ);
191192
pageBuffer->prev = InvalidBlockNumber;
192193

193194
/* Set page free space */

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/fa19a08d71fbeefc39415d9c6c70128460d41f94

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy