diff options
author | dan <dan@noemail.net> | 2016-01-29 08:38:35 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2016-01-29 08:38:35 +0000 |
commit | 98a4d5a7fa997ddabe04c1352acedfb080d0b506 (patch) | |
tree | 9c7ae5de4891d21625e873361c969fd5ed2785b1 /src | |
parent | 895c00e16a0308b0e0fc9fb49c1c6fdc8713af46 (diff) | |
download | sqlite-98a4d5a7fa997ddabe04c1352acedfb080d0b506.tar.gz sqlite-98a4d5a7fa997ddabe04c1352acedfb080d0b506.zip |
Avoid two more instances of pointer arithmetic on freed pointers.
FossilOrigin-Name: 2910ef64097b890c9f8929bf609ea2827db7ac97
Diffstat (limited to 'src')
-rw-r--r-- | src/prepare.c | 2 | ||||
-rw-r--r-- | src/vdbesort.c | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/prepare.c b/src/prepare.c index acd50fcaf..f8ad54665 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -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]; } diff --git a/src/vdbesort.c b/src/vdbesort.c index 22029aa6b..380772ee1 100644 --- a/src/vdbesort.c +++ b/src/vdbesort.c @@ -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; } |