aboutsummaryrefslogtreecommitdiff
path: root/src/vdbeaux.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-02-05 01:55:27 +0000
committerdrh <drh@noemail.net>2016-02-05 01:55:27 +0000
commit4a642b60607e55a2c25f663b472af3609c76b214 (patch)
treed4af5d6c69d8cde0c32bfcc7a427eb34c2815080 /src/vdbeaux.c
parente514f651d0fb5364e6495b9d6c4dd80ca51a227f (diff)
downloadsqlite-4a642b60607e55a2c25f663b472af3609c76b214.tar.gz
sqlite-4a642b60607e55a2c25f663b472af3609c76b214.zip
Improvements to the way that OOM errors are processed.
FossilOrigin-Name: c3ef03478a5788c855b3aef385d43ae7f494f440
Diffstat (limited to 'src/vdbeaux.c')
-rw-r--r--src/vdbeaux.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 632c1231a..7d3a8c429 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -1423,7 +1423,6 @@ static void releaseMemArray(Mem *p, int N){
if( p && N ){
Mem *pEnd = &p[N];
sqlite3 *db = p->db;
- u8 malloc_failed = db->mallocFailed;
if( db->pnBytesFreed ){
do{
if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
@@ -1459,7 +1458,6 @@ static void releaseMemArray(Mem *p, int N){
p->flags = MEM_Undefined;
}while( (++p)<pEnd );
- db->mallocFailed = malloc_failed;
}
}
@@ -1520,7 +1518,7 @@ int sqlite3VdbeList(
if( p->rc==SQLITE_NOMEM ){
/* This happens if a malloc() inside a call to sqlite3_column_text() or
** sqlite3_column_text16() failed. */
- db->mallocFailed = 1;
+ sqlite3OomFault(db);
return SQLITE_ERROR;
}
@@ -2711,12 +2709,12 @@ int sqlite3VdbeTransferError(Vdbe *p){
sqlite3 *db = p->db;
int rc = p->rc;
if( p->zErrMsg ){
- u8 mallocFailed = db->mallocFailed;
+ db->bBenignMalloc++;
sqlite3BeginBenignMalloc();
if( db->pErr==0 ) db->pErr = sqlite3ValueNew(db);
sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT);
sqlite3EndBenignMalloc();
- db->mallocFailed = mallocFailed;
+ db->bBenignMalloc--;
db->errCode = rc;
}else{
sqlite3Error(db, rc);