postgres.git / summary / log / commit / refs

commit    7b60468fa14ac8b65ba91f2dc3c2df11361d4be3
Author:   Michael Paquier <michael@paquier.xyz>
Date:     Wed Jul 10 06:15:29 2019 +0000
First released in: 13.0, 9.4.24, 9.5.19, 9.6.15, 10.10, 11.5, 12.0

    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


src/backend/access/gist/gistbuildbuffers.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/access/gist/gistbuildbuffers.c b/src/backend/access/gist/gistbuildbuffers.c index 577ea613b11..b92052eddb3 100644 --- a/src/backend/access/gist/gistbuildbuffers.c +++ b/src/backend/access/gist/gistbuildbuffers.c @@ -140,6 +140,7 @@ gistGetNodeBuffer(GISTBuildBuffers *gfbb, GISTSTATE *giststate, nodeBuffer->pageBlocknum = InvalidBlockNumber; nodeBuffer->pageBuffer = NULL; nodeBuffer->queuedForEmptying = false; + nodeBuffer->isTemp = false; nodeBuffer->level = level; /* @@ -188,8 +189,8 @@ gistAllocateNewPageBuffer(GISTBuildBuffers *gfbb) { GISTNodeBufferPage *pageBuffer; - pageBuffer = (GISTNodeBufferPage *) MemoryContextAlloc(gfbb->context, - BLCKSZ); + pageBuffer = (GISTNodeBufferPage *) MemoryContextAllocZero(gfbb->context, + BLCKSZ); pageBuffer->prev = InvalidBlockNumber; /* Set page free space */ [parent: d49c127d90f9]