Index: src/malloc.c ================================================================== --- src/malloc.c +++ src/malloc.c @@ -10,11 +10,11 @@ ** ************************************************************************* ** ** Memory allocation functions used throughout sqlite. ** -** $Id: malloc.c,v 1.63 2009/06/26 18:35:17 drh Exp $ +** $Id: malloc.c,v 1.64 2009/06/27 00:48:33 drh Exp $ */ #include "sqliteInt.h" #include /* @@ -471,14 +471,17 @@ int nOld, nNew; void *pNew; if( pOld==0 ){ return sqlite3Malloc(nBytes); } - if( nBytes<=0 || nBytes>=0x7fffff00 ){ - /* The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() */ + if( nBytes<=0 ){ sqlite3_free(pOld); return 0; + } + if( nBytes>=0x7fffff00 ){ + /* The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() */ + return 0; } nOld = sqlite3MallocSize(pOld); if( sqlite3GlobalConfig.bMemstat ){ sqlite3_mutex_enter(mem0.mutex); sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, nBytes);