Description
If a database file is opened and closed several times within a project, it fails after 2 or 3 successful connects.
I tracked this down to the function sqlite3mcTermCipherTables() which obviousley is freeing initializations performed by sqlite3mcRegisterCipher(). If --globalCipherCount; is added within the function everything seems to be working:
SQLITE_PRIVATE void
sqlite3mcTermCipherTables()
{
size_t n;
for (n = CODEC_COUNT_MAX+1; n > 0; --n)
{
if (globalCodecParameterTable[n].m_name[0] != 0)
{
int k;
CipherParams* params = globalCodecParameterTable[n].m_params;
for (k = 0; params[k].m_name[0] != 0; ++k)
{
sqlite3_free(params[k].m_name);
}
sqlite3_free(globalCodecParameterTable[n].m_params);
--globalCipherCount;
}
}
}
Please check if this fix is correct - since I'm not familiar with the internal structures used.