1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

The KeyInfo cache must be cleared before closing the btree, not after.

Revised fix for ticket [e4a18565a36884b00edf].

FossilOrigin-Name: 7ed3346e8c10dbf52fd44ab69900699d4f7ad3fd
This commit is contained in:
drh
2014-12-05 15:31:33 +00:00
parent 318dc0b425
commit ebdb81dd45
3 changed files with 13 additions and 10 deletions

View File

@@ -1032,15 +1032,17 @@ void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
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 ){
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;
}
}