]> granicus.if.org Git - postgresql/commitdiff
Fix bug in generation.c's valgrind support.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 24 Nov 2017 18:43:34 +0000 (13:43 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 24 Nov 2017 18:43:34 +0000 (13:43 -0500)
This doesn't look like the last such bug, but it's one that the
test_decoding regression test is tripping over.  Per buildfarm.

Tomas Vondra

Discussion: https://postgr.es/m/c903f275-2150-fa52-64bf-dca7b53ebf8d@fuzzy.cz

src/backend/utils/mmgr/generation.c

index 2ede8e1be93ff9392e2fdc9e19ca64b014202ec6..a748ee266c2010b0e37512d2468499fe4256f937 100644 (file)
@@ -409,9 +409,14 @@ GenerationAlloc(MemoryContext context, Size size)
 
        chunk = (GenerationChunk *) block->freeptr;
 
+       /* Prepare to initialize the chunk header. */
+       VALGRIND_MAKE_MEM_UNDEFINED(chunk, Generation_CHUNKHDRSZ);
+
        block->nchunks += 1;
        block->freeptr += (Generation_CHUNKHDRSZ + chunk_size);
 
+       Assert(block->freeptr <= block->endptr);
+
        chunk->block = block;
 
        chunk->context = set;