1
0
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:
drh
2005-08-21 21:45:01 +00:00
parent 03e7954732
commit ad81e87054
3 changed files with 10 additions and 10 deletions

View File

@@ -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 */