mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-27 08:52:26 +03:00
Clean up possible locking problem in multithreaded applications that take
a malloc failure. (CVS 2611) FossilOrigin-Name: 545e702a23c7a6b09e10441d4137efe5a9618a84
This commit is contained in:
@@ -1278,13 +1278,13 @@ int sqlite3OsClose(OsFile *id){
|
||||
*/
|
||||
int *aNew;
|
||||
struct openCnt *pOpen = id->pOpen;
|
||||
pOpen->nPending++;
|
||||
aNew = sqliteRealloc( pOpen->aPending, pOpen->nPending*sizeof(int) );
|
||||
aNew = sqliteRealloc( pOpen->aPending, (pOpen->nPending+1)*sizeof(int) );
|
||||
if( aNew==0 ){
|
||||
/* If a malloc fails, just leak the file descriptor */
|
||||
}else{
|
||||
pOpen->aPending = aNew;
|
||||
pOpen->aPending[pOpen->nPending-1] = id->h;
|
||||
pOpen->aPending[pOpen->nPending] = id->h;
|
||||
pOpen->nPending++;
|
||||
}
|
||||
}else{
|
||||
/* There are no outstanding locks so we can close the file immediately */
|
||||
|
||||
Reference in New Issue
Block a user