Avoid two more instances of pointer arithmetic on freed pointers.
FossilOrigin-Name: 2910ef64097b890c9f8929bf609ea2827db7ac97
This commit is contained in:
+1
-1
@@ -582,8 +582,8 @@ static int sqlite3Prepare(
|
||||
zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);
|
||||
if( zSqlCopy ){
|
||||
sqlite3RunParser(pParse, zSqlCopy, &zErrMsg);
|
||||
sqlite3DbFree(db, zSqlCopy);
|
||||
pParse->zTail = &zSql[pParse->zTail-zSqlCopy];
|
||||
sqlite3DbFree(db, zSqlCopy);
|
||||
}else{
|
||||
pParse->zTail = &zSql[nBytes];
|
||||
}
|
||||
|
||||
+2
-3
@@ -1821,6 +1821,7 @@ int sqlite3VdbeSorterWrite(
|
||||
|
||||
if( nMin>pSorter->nMemory ){
|
||||
u8 *aNew;
|
||||
int iListOff = (u8*)pSorter->list.pList - pSorter->list.aMemory;
|
||||
int nNew = pSorter->nMemory * 2;
|
||||
while( nNew < nMin ) nNew = nNew*2;
|
||||
if( nNew > pSorter->mxPmaSize ) nNew = pSorter->mxPmaSize;
|
||||
@@ -1828,9 +1829,7 @@ int sqlite3VdbeSorterWrite(
|
||||
|
||||
aNew = sqlite3Realloc(pSorter->list.aMemory, nNew);
|
||||
if( !aNew ) return SQLITE_NOMEM;
|
||||
pSorter->list.pList = (SorterRecord*)(
|
||||
aNew + ((u8*)pSorter->list.pList - pSorter->list.aMemory)
|
||||
);
|
||||
pSorter->list.pList = (SorterRecord*)&aNew[iListOff];
|
||||
pSorter->list.aMemory = aNew;
|
||||
pSorter->nMemory = nNew;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user