diff options
author | drh <drh@noemail.net> | 2011-12-07 01:47:27 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2011-12-07 01:47:27 +0000 |
commit | e7e6a54504d246345e79384a5d28f11f18878b84 (patch) | |
tree | b69d2ab4673c6b51bf6823594984a9f0ae56ca2b /src/expr.c | |
parent | a84203a0749e49cfff15fb99588a0158b6fd085e (diff) | |
download | sqlite-e7e6a54504d246345e79384a5d28f11f18878b84.tar.gz sqlite-e7e6a54504d246345e79384a5d28f11f18878b84.zip |
Bug fix in sqlite3SelectDup(). Make sure the pNext pointer is valid.
FossilOrigin-Name: 7e5b56b1c602d4adfd4496a9c877f3b685b2d360
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c index 0d217ed40..09f07abf4 100644 --- a/src/expr.c +++ b/src/expr.c @@ -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; |