diff options
author | danielk1977 <danielk1977@noemail.net> | 2008-01-23 17:13:40 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2008-01-23 17:13:40 +0000 |
commit | ac559264e3af94983212e8936438b88ae99eef8f (patch) | |
tree | ef6ff6dfb242f1d1daae290b2605500ac65c97d4 /src/select.c | |
parent | 15cdbebe08a7f6b3cdd1bd0e8c3b8b8ce5383f2b (diff) | |
download | sqlite-ac559264e3af94983212e8936438b88ae99eef8f.tar.gz sqlite-ac559264e3af94983212e8936438b88ae99eef8f.zip |
Fix another segfault that can occur following a malloc failure in the SQL compiler. (CVS 4748)
FossilOrigin-Name: 9d98a3f0dded4ee7ed53872f48ee8592ff077f92
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/select.c b/src/select.c index 49d179cf2..f22527585 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.408 2008/01/23 15:44:51 danielk1977 Exp $ +** $Id: select.c,v 1.409 2008/01/23 17:13:41 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -1676,15 +1676,15 @@ static int processCompoundOrderBy( while( pSelect && moreToDo ){ moreToDo = 0; for(i=0; i<pOrderBy->nExpr; i++){ - int iCol; + int iCol = -1; Expr *pE, *pDup; if( pOrderBy->a[i].done ) continue; pE = pOrderBy->a[i].pExpr; pDup = sqlite3ExprDup(db, pE); - if( pDup==0 ){ - return 1; + if( !db->mallocFailed ){ + assert(pDup); + iCol = matchOrderByTermToExprList(pParse, pSelect, pDup, i+1, 1, 0); } - iCol = matchOrderByTermToExprList(pParse, pSelect, pDup, i+1, 1, 0); sqlite3ExprDelete(pDup); if( iCol<0 ){ return 1; |