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

Fix a whole host of newly discovered memory leaks the occur after a

failure of realloc(). (CVS 2696)

FossilOrigin-Name: 4686d649756a0aa301ade901ac49c89a976c5402
This commit is contained in:
drh
2005-09-16 02:38:09 +00:00
parent b38ad9991c
commit 53f733c7ae
11 changed files with 97 additions and 49 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.227 2005/09/09 01:33:19 drh Exp $
** $Id: expr.c,v 1.228 2005/09/16 02:38:10 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -355,7 +355,7 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
pExpr->iTable = ++pParse->nVar;
if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){
pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10;
pParse->apVarExpr = sqliteRealloc(pParse->apVarExpr,
sqlite3ReallocOrFree((void**)&pParse->apVarExpr,
pParse->nVarExprAlloc*sizeof(pParse->apVarExpr[0]) );
}
if( !sqlite3_malloc_failed ){
@@ -1291,7 +1291,7 @@ void sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
int mem = pParse->nMem++;
sqlite3VdbeAddOp(v, OP_MemLoad, mem, 0);
testAddr = sqlite3VdbeAddOp(v, OP_If, 0, 0);
assert( testAddr>0 );
assert( testAddr>0 || sqlite3_malloc_failed );
sqlite3VdbeAddOp(v, OP_Integer, 1, 0);
sqlite3VdbeAddOp(v, OP_MemStore, mem, 1);
}