/ Check-in [48529508]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:The KeyInfo cache must be cleared before closing the btree, not after. Revised fix for ticket [e4a18565a36884b00edf].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.8.7
Files: files | file ages | folders
SHA1: 48529508cfe2f9445a6940222fe5ff7cc92aef78
User & Date: drh 2014-12-05 15:25:49
Context
2014-12-05
20:43
Fix a buffer overread that might occur in analyze.c if SQLITE_ENABLE_STAT4 was defined. check-in: 194c90db user: dan tags: branch-3.8.7
15:31
The KeyInfo cache must be cleared before closing the btree, not after. Revised fix for ticket [e4a18565a36884b00edf]. check-in: 7ed3346e user: drh tags: trunk
15:25
The KeyInfo cache must be cleared before closing the btree, not after. Revised fix for ticket [e4a18565a36884b00edf]. check-in: 48529508 user: drh tags: branch-3.8.7
14:54
Increase the version number to 3.8.7.3. check-in: 9f7560bc user: drh tags: branch-3.8.7
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

   926    926     /* Free any outstanding Savepoint structures. */
   927    927     sqlite3CloseSavepoints(db);
   928    928   
   929    929     /* Close all database connections */
   930    930     for(j=0; j<db->nDb; j++){
   931    931       struct Db *pDb = &db->aDb[j];
   932    932       if( pDb->pBt ){
   933         -      sqlite3BtreeClose(pDb->pBt);
   934         -      pDb->pBt = 0;
   935         -      if( j!=1 && pDb->pSchema ){
          933  +      if( pDb->pSchema ){
   936    934           /* Must clear the KeyInfo cache.  See ticket [e4a18565a36884b00edf] */
   937    935           for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){
   938    936             Index *pIdx = sqliteHashData(i);
   939    937             sqlite3KeyInfoUnref(pIdx->pKeyInfo);
   940    938             pIdx->pKeyInfo = 0;
   941    939           }
          940  +      }
          941  +      sqlite3BtreeClose(pDb->pBt);
          942  +      pDb->pBt = 0;
          943  +      if( j!=1 ){
   942    944           pDb->pSchema = 0;
   943    945         }
   944    946       }
   945    947     }
   946    948     /* Clear the TEMP schema separately and last */
   947    949     if( db->aDb[1].pSchema ){
   948    950       sqlite3SchemaClear(db->aDb[1].pSchema);