Skip to content

Commit 4fea343

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 72b5267 commit 4fea343

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy