diff options
author | dan <dan@noemail.net> | 2013-10-16 11:39:07 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2013-10-16 11:39:07 +0000 |
commit | 14285b7067976f8508fe2a532d382610fe641353 (patch) | |
tree | efb006bd9d322ffd443b2dc3d026c77f305c70b4 /src | |
parent | 0353ed21365210a3149107445b22dcf6623fee16 (diff) | |
download | sqlite-14285b7067976f8508fe2a532d382610fe641353.tar.gz sqlite-14285b7067976f8508fe2a532d382610fe641353.zip |
Clear a valgrind error by zeroing the first 4 bytes of the temp-space allocation used by the b-tree module.
FossilOrigin-Name: 8651aba1865a8f82d21d3345f33fbd239fd9a042
Diffstat (limited to 'src')
-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); } } |