aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vdbeaux.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index b09c741bf..1c0908d5b 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -14,7 +14,7 @@
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
**
-** $Id: vdbeaux.c,v 1.478 2009/07/24 17:58:53 danielk1977 Exp $
+** $Id: vdbeaux.c,v 1.479 2009/07/25 17:42:22 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"
@@ -1064,7 +1064,7 @@ static void allocSpace(
assert( EIGHT_BYTE_ALIGNMENT(*ppFrom) );
if( (*(void**)pp)==0 ){
nByte = ROUND8(nByte);
- if( (pEnd - *ppFrom)>=nByte ){
+ if( &(*ppFrom)[nByte] <= pEnd ){
*(void**)pp = (void *)*ppFrom;
*ppFrom += nByte;
}else{
@@ -1135,12 +1135,11 @@ void sqlite3VdbeMakeReady(
if( isExplain && nMem<10 ){
nMem = 10;
}
+ memset(zCsr, 0, zEnd-zCsr);
zCsr += (zCsr - (u8*)0)&7;
assert( EIGHT_BYTE_ALIGNMENT(zCsr) );
- if( zEnd<zCsr ) zEnd = zCsr;
do {
- memset(zCsr, 0, zEnd-zCsr);
nByte = 0;
allocSpace((char*)&p->aMem, nMem*sizeof(Mem), &zCsr, zEnd, &nByte);
allocSpace((char*)&p->aVar, nVar*sizeof(Mem), &zCsr, zEnd, &nByte);
@@ -1150,7 +1149,7 @@ void sqlite3VdbeMakeReady(
nCursor*sizeof(VdbeCursor*), &zCsr, zEnd, &nByte
);
if( nByte ){
- p->pFree = sqlite3DbMallocRaw(db, nByte);
+ p->pFree = sqlite3DbMallocZero(db, nByte);
}
zCsr = p->pFree;
zEnd = &zCsr[nByte];