mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	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
			
			
This commit is contained in:
		@@ -138,6 +138,7 @@ gistGetNodeBuffer(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
 | 
				
			|||||||
		nodeBuffer->pageBlocknum = InvalidBlockNumber;
 | 
							nodeBuffer->pageBlocknum = InvalidBlockNumber;
 | 
				
			||||||
		nodeBuffer->pageBuffer = NULL;
 | 
							nodeBuffer->pageBuffer = NULL;
 | 
				
			||||||
		nodeBuffer->queuedForEmptying = false;
 | 
							nodeBuffer->queuedForEmptying = false;
 | 
				
			||||||
 | 
							nodeBuffer->isTemp = false;
 | 
				
			||||||
		nodeBuffer->level = level;
 | 
							nodeBuffer->level = level;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
@@ -186,7 +187,7 @@ gistAllocateNewPageBuffer(GISTBuildBuffers *gfbb)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	GISTNodeBufferPage *pageBuffer;
 | 
						GISTNodeBufferPage *pageBuffer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pageBuffer = (GISTNodeBufferPage *) MemoryContextAlloc(gfbb->context,
 | 
						pageBuffer = (GISTNodeBufferPage *) MemoryContextAllocZero(gfbb->context,
 | 
				
			||||||
															   BLCKSZ);
 | 
																				   BLCKSZ);
 | 
				
			||||||
	pageBuffer->prev = InvalidBlockNumber;
 | 
						pageBuffer->prev = InvalidBlockNumber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user