mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-03 16:53:36 +03:00
Improvements to the way that OOM errors are processed.
FossilOrigin-Name: c3ef03478a5788c855b3aef385d43ae7f494f440
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user