diff options
author | drh <drh@noemail.net> | 2015-06-30 03:13:47 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-06-30 03:13:47 +0000 |
commit | 597d2b6412a38ca8ce0312579d0acaf4035aaee9 (patch) | |
tree | 25eeed7585d9f6e15927cef212d765b34f47c99a /src/malloc.c | |
parent | 27fb746cde8eda3889ebbda44f576db991ba2b5b (diff) | |
download | sqlite-597d2b6412a38ca8ce0312579d0acaf4035aaee9.tar.gz sqlite-597d2b6412a38ca8ce0312579d0acaf4035aaee9.zip |
Change sqlite3ApiExit() so that its first argument is never NULL.
FossilOrigin-Name: 791b706ec6c3e80885666e48e01524f0e9a7557e
Diffstat (limited to 'src/malloc.c')
-rw-r--r-- | src/malloc.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/malloc.c b/src/malloc.c index 1b9a20956..97b9cd577 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -796,17 +796,16 @@ static SQLITE_NOINLINE int apiOomError(sqlite3 *db){ ** function. However, if a malloc() failure has occurred since the previous ** invocation SQLITE_NOMEM is returned instead. ** -** If the first argument, db, is not NULL and a malloc() error has occurred, -** then the connection error-code (the value returned by sqlite3_errcode()) -** is set to SQLITE_NOMEM. +** If an OOM as occurred, then the connection error-code (the value +** returned by sqlite3_errcode()) is set to SQLITE_NOMEM. */ int sqlite3ApiExit(sqlite3* db, int rc){ - /* If the db handle is not NULL, then we must hold the connection handle - ** mutex here. Otherwise the read (and possible write) of db->mallocFailed + /* If the db handle must hold the connection handle mutex here. + ** Otherwise the read (and possible write) of db->mallocFailed ** is unsafe, as is the call to sqlite3Error(). */ - assert( !db || sqlite3_mutex_held(db->mutex) ); - if( db==0 ) return rc & 0xff; + assert( db!=0 ); + assert( sqlite3_mutex_held(db->mutex) ); if( db->mallocFailed || rc==SQLITE_IOERR_NOMEM ){ return apiOomError(db); } |