1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-08 03:22:21 +03:00

Bug fix in sqlite3SelectDup(). Make sure the pNext pointer is valid.

FossilOrigin-Name: 7e5b56b1c602d4adfd4496a9c877f3b685b2d360
This commit is contained in:
drh
2011-12-07 01:47:27 +00:00
parent a84203a074
commit e7e6a54504
3 changed files with 11 additions and 9 deletions

View File

@@ -940,7 +940,7 @@ IdList *sqlite3IdListDup(sqlite3 *db, IdList *p){
return pNew;
}
Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){
Select *pNew;
Select *pNew, *pPrior;
if( p==0 ) return 0;
pNew = sqlite3DbMallocRaw(db, sizeof(*p) );
if( pNew==0 ) return 0;
@@ -951,7 +951,9 @@ Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){
pNew->pHaving = sqlite3ExprDup(db, p->pHaving, flags);
pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, flags);
pNew->op = p->op;
pNew->pPrior = sqlite3SelectDup(db, p->pPrior, flags);
pNew->pPrior = pPrior = sqlite3SelectDup(db, p->pPrior, flags);
if( pPrior ) pPrior->pNext = pNew;
pNew->pNext = 0;
pNew->pLimit = sqlite3ExprDup(db, p->pLimit, flags);
pNew->pOffset = sqlite3ExprDup(db, p->pOffset, flags);
pNew->iLimit = 0;