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

Fix a memory leak on ORDER BY of a compound select caused by the resolver

on a flattened query.  Also fix a OOM segfault in WHERE clause processing. (CVS 5801)

FossilOrigin-Name: d2c252d6bbde4ae14da6c9e6c2683d763d11c59f
This commit is contained in:
drh
2008-10-11 16:47:35 +00:00
parent 4150ebf86f
commit 10fe840e4d
6 changed files with 30 additions and 23 deletions

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.398 2008/10/07 19:53:14 drh Exp $
** $Id: expr.c,v 1.399 2008/10/11 16:47:36 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -601,16 +601,24 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
}
/*
** Recursively delete an expression tree.
** Clear an expression structure without deleting the structure itself.
** Substructure is deleted.
*/
void sqlite3ExprDelete(sqlite3 *db, Expr *p){
if( p==0 ) return;
void sqlite3ExprClear(sqlite3 *db, Expr *p){
if( p->span.dyn ) sqlite3DbFree(db, (char*)p->span.z);
if( p->token.dyn ) sqlite3DbFree(db, (char*)p->token.z);
sqlite3ExprDelete(db, p->pLeft);
sqlite3ExprDelete(db, p->pRight);
sqlite3ExprListDelete(db, p->pList);
sqlite3SelectDelete(db, p->pSelect);
}
/*
** Recursively delete an expression tree.
*/
void sqlite3ExprDelete(sqlite3 *db, Expr *p){
if( p==0 ) return;
sqlite3ExprClear(db, p);
sqlite3DbFree(db, p);
}