In the async-IO module, do not increment the open file-counter until after an "open file" event has been added to the event queue. Otherwise, an OOM may cause the system to increment the counter even though no file was successfully opened.
FossilOrigin-Name: 15a190dc5769beb53b89254543e744a964cd86ed
diff --git a/ext/async/sqlite3async.c b/ext/async/sqlite3async.c
index 0590230..a351eaa 100644
--- a/ext/async/sqlite3async.c
+++ b/ext/async/sqlite3async.c
@@ -1143,7 +1143,6 @@
async_mutex_leave(ASYNC_MUTEX_LOCK);
if( rc==SQLITE_OK ){
- incrOpenFileCount();
pData->pLock = pLock;
}
@@ -1160,7 +1159,10 @@
}
if( rc!=SQLITE_OK ){
p->pMethod = 0;
+ }else{
+ incrOpenFileCount();
}
+
return rc;
}