diff options
author | danielk1977 <danielk1977@noemail.net> | 2008-06-30 10:16:04 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2008-06-30 10:16:04 +0000 |
commit | 6cb427f5c4af9b526d21327341374c5eea1e632e (patch) | |
tree | 7a6b12729e5ee05d3571069a0b2b6ce8fda326c2 /src/os_unix.c | |
parent | 7a8097b6d8ac6122ddecfb036de29130510c7764 (diff) | |
download | sqlite-6cb427f5c4af9b526d21327341374c5eea1e632e.tar.gz sqlite-6cb427f5c4af9b526d21327341374c5eea1e632e.zip |
Fix a malloc() failure related problem in os_unix.c. (CVS 5328)
FossilOrigin-Name: ba8819a6f3dbc45d88346789de42971aacc0d246
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 1b93b792a..45550951f 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -12,7 +12,7 @@ ** ** This file contains code that is specific to Unix systems. ** -** $Id: os_unix.c,v 1.191 2008/06/28 11:23:00 danielk1977 Exp $ +** $Id: os_unix.c,v 1.192 2008/06/30 10:16:05 danielk1977 Exp $ */ #include "sqliteInt.h" #if SQLITE_OS_UNIX /* This file is used on unix only */ @@ -1463,7 +1463,7 @@ static int unixClose(sqlite3_file *id){ unixFile *pFile = (unixFile *)id; unixUnlock(id, NO_LOCK); enterMutex(); - if( pFile->pOpen->nLock ){ + if( pFile->pOpen && pFile->pOpen->nLock ){ /* If there are outstanding locks, do not actually close the file just ** yet because that would clear those locks. Instead, add the file ** descriptor to pOpen->aPending. It will be automatically closed when @@ -2095,7 +2095,6 @@ static int fillInUnixFile( assert(LOCKING_STYLE_NONE==4); assert(LOCKING_STYLE_AFP==5); eLockingStyle = detectLockingStyle(pVfs, zFilename, h); - pNew->pMethod = &aIoMethod[eLockingStyle-1]; switch( eLockingStyle ){ @@ -2152,6 +2151,7 @@ static int fillInUnixFile( if( dirfd>=0 ) close(dirfd); close(h); }else{ + pNew->pMethod = &aIoMethod[eLockingStyle-1]; OpenCounter(+1); } return rc; |