diff options
author | Keith Bostic <keith@wiredtiger.com> | 2016-03-14 13:23:03 +0000 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2016-03-14 13:23:03 +0000 |
commit | 1fd5955e494b17617211778acb1a17d59f412b3c (patch) | |
tree | 3e7ce8aee4ef86ffca1677c742c801b787f2269f /src | |
parent | dee838189e67a4a68313450c98042ec17321285f (diff) | |
download | mongo-1fd5955e494b17617211778acb1a17d59f412b3c.tar.gz |
WT-2478: Valgrind test failures
Too many places create buffers we write (for example, encryption).
Quit trying to initialize the block header information in any place
other than the block header code.
Diffstat (limited to 'src')
-rw-r--r-- | src/block/block_write.c | 8 | ||||
-rw-r--r-- | src/reconcile/rec_write.c | 12 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/block/block_write.c b/src/block/block_write.c index 4c6ac198fe4..e05a430832e 100644 --- a/src/block/block_write.c +++ b/src/block/block_write.c @@ -206,10 +206,16 @@ __wt_block_write_off(WT_SESSION_IMPL *session, WT_BLOCK *block, uint32_t cksum; bool local_locked; - blk = WT_BLOCK_HEADER_REF(buf->mem); fh = block->fh; /* + * Clear the block header to ensure all of it is initialized, even the + * unused fields. + */ + blk = WT_BLOCK_HEADER_REF(buf->mem); + memset(blk, 0, sizeof(*blk)); + + /* * Swap the page-header as needed; this doesn't belong here, but it's * the best place to catch all callers. */ diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index 9b1ff9ede74..a69f335c9b3 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -1960,13 +1960,15 @@ __rec_split_init(WT_SESSION_IMPL *session, WT_RET(__wt_buf_init(session, &r->disk_image, corrected_page_size)); /* - * Clear at least the disk page's header and block-manager space, but - * in the case of fixed-length column-store, clear the entire buffer. - * (Fixed-length column-store sets bits in bytes, and the bytes are - * assumed to be initially 0.) + * Clear the disk page header to ensure all of it is initialized, even + * the unused fields. + * + * In the case of fixed-length column-store, clear the entire buffer: + * fixed-length column-store sets bits in bytes, where the bytes are + * assumed to initially be 0. */ memset(r->disk_image.mem, 0, page->type == WT_PAGE_COL_FIX ? - corrected_page_size : WT_PAGE_HEADER_BYTE_SIZE(btree)); + corrected_page_size : WT_PAGE_HEADER_SIZE); /* * Set the page type (the type doesn't change, and setting it later |