mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
Merge latest trunk with this branch.
FossilOrigin-Name: 854a54c6c21e800b0cd999023014813f7c50b23f
This commit is contained in:
22
src/btree.c
22
src/btree.c
@@ -2144,7 +2144,8 @@ static int removeFromSharingList(BtShared *pBt){
|
||||
|
||||
/*
|
||||
** Make sure pBt->pTmpSpace points to an allocation of
|
||||
** MX_CELL_SIZE(pBt) bytes.
|
||||
** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child
|
||||
** pointer.
|
||||
*/
|
||||
static void allocateTempSpace(BtShared *pBt){
|
||||
if( !pBt->pTmpSpace ){
|
||||
@@ -2159,8 +2160,16 @@ static void allocateTempSpace(BtShared *pBt){
|
||||
** 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);
|
||||
** zero the first 4 bytes of temp space here.
|
||||
**
|
||||
** Also: Provide four bytes of initialized space before the
|
||||
** beginning of pTmpSpace as an area available to prepend the
|
||||
** left-child pointer to the beginning of a cell.
|
||||
*/
|
||||
if( pBt->pTmpSpace ){
|
||||
memset(pBt->pTmpSpace, 0, 8);
|
||||
pBt->pTmpSpace += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2168,8 +2177,11 @@ static void allocateTempSpace(BtShared *pBt){
|
||||
** Free the pBt->pTmpSpace allocation
|
||||
*/
|
||||
static void freeTempSpace(BtShared *pBt){
|
||||
sqlite3PageFree( pBt->pTmpSpace);
|
||||
pBt->pTmpSpace = 0;
|
||||
if( pBt->pTmpSpace ){
|
||||
pBt->pTmpSpace -= 4;
|
||||
sqlite3PageFree(pBt->pTmpSpace);
|
||||
pBt->pTmpSpace = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user