diff options
author | drh <drh@noemail.net> | 2013-10-16 14:32:47 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-10-16 14:32:47 +0000 |
commit | d82d4750a80e474a9be03a6c9abb7fde1dc44ce2 (patch) | |
tree | 67eaa8483e4dbefaad33259513b7bd601c9c51b4 /src/btree.c | |
parent | 9327c70f6834c532679e66e7198d1844a6067509 (diff) | |
parent | 14285b7067976f8508fe2a532d382610fe641353 (diff) | |
download | sqlite-d82d4750a80e474a9be03a6c9abb7fde1dc44ce2.tar.gz sqlite-d82d4750a80e474a9be03a6c9abb7fde1dc44ce2.zip |
Merge the latest trunk changes.
FossilOrigin-Name: 5806546822b717d712dc7cd9de88a86f5bf2f715
Diffstat (limited to 'src/btree.c')
-rw-r--r-- | src/btree.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/btree.c b/src/btree.c index 3ce70fe48..d56dfbddb 100644 --- a/src/btree.c +++ b/src/btree.c @@ -2052,6 +2052,18 @@ static int removeFromSharingList(BtShared *pBt){ static void allocateTempSpace(BtShared *pBt){ if( !pBt->pTmpSpace ){ pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize ); + + /* One of the uses of pBt->pTmpSpace is to format cells before + ** inserting them into a leaf page (function fillInCell()). If + ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes + ** by the various routines that manipulate binary cells. Which + ** can mean that fillInCell() only initializes the first 2 or 3 + ** bytes of pTmpSpace, but that the first 4 bytes are copied from + ** it into a database page. This is not actually a problem, but it + ** does cause a valgrind error when the 1 or 2 bytes of unitialized + ** data is passed to system call write(). So to avoid this error, + ** zero the first 4 bytes of temp space here. */ + if( pBt->pTmpSpace ) memset(pBt->pTmpSpace, 0, 4); } } |