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

Fix another segfault that can occur following a malloc failure in the SQL compiler. (CVS 4748)

FossilOrigin-Name: 9d98a3f0dded4ee7ed53872f48ee8592ff077f92
This commit is contained in:
danielk1977
2008-01-23 17:13:40 +00:00
parent 15cdbebe08
commit ac559264e3
4 changed files with 22 additions and 14 deletions

View File

@@ -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;