SQLite

Check-in [48529508cf]
Login

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
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.142
Context
2014-12-05
20:43
Fix a buffer overread that might occur in analyze.c if SQLITE_ENABLE_STAT4 was defined. (check-in: 194c90db63 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: 7ed3346e8c 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: 48529508cf user: drh tags: branch-3.8.7)
14:54
Increase the version number to 3.8.7.3. (check-in: 9f7560bc45 user: drh tags: branch-3.8.7)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941




942
943
944
945
946
947
948
  /* Free any outstanding Savepoint structures. */
  sqlite3CloseSavepoints(db);

  /* Close all database connections */
  for(j=0; j<db->nDb; j++){
    struct Db *pDb = &db->aDb[j];
    if( pDb->pBt ){
      sqlite3BtreeClose(pDb->pBt);
      pDb->pBt = 0;
      if( j!=1 && pDb->pSchema ){
        /* Must clear the KeyInfo cache.  See ticket [e4a18565a36884b00edf] */
        for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){
          Index *pIdx = sqliteHashData(i);
          sqlite3KeyInfoUnref(pIdx->pKeyInfo);
          pIdx->pKeyInfo = 0;
        }




        pDb->pSchema = 0;
      }
    }
  }
  /* Clear the TEMP schema separately and last */
  if( db->aDb[1].pSchema ){
    sqlite3SchemaClear(db->aDb[1].pSchema);







<
<
|






>
>
>
>







926
927
928
929
930
931
932


933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
  /* Free any outstanding Savepoint structures. */
  sqlite3CloseSavepoints(db);

  /* Close all database connections */
  for(j=0; j<db->nDb; j++){
    struct Db *pDb = &db->aDb[j];
    if( pDb->pBt ){


      if( pDb->pSchema ){
        /* Must clear the KeyInfo cache.  See ticket [e4a18565a36884b00edf] */
        for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){
          Index *pIdx = sqliteHashData(i);
          sqlite3KeyInfoUnref(pIdx->pKeyInfo);
          pIdx->pKeyInfo = 0;
        }
      }
      sqlite3BtreeClose(pDb->pBt);
      pDb->pBt = 0;
      if( j!=1 ){
        pDb->pSchema = 0;
      }
    }
  }
  /* Clear the TEMP schema separately and last */
  if( db->aDb[1].pSchema ){
    sqlite3SchemaClear(db->aDb[1].pSchema);