Prevent deadlock of database mutex

This commit is contained in:
Nick Parker 2016-05-13 16:28:34 -05:00
parent d7120d73b4
commit e873a49d99
1 changed files with 5 additions and 1 deletions

View File

@ -365,7 +365,11 @@ int sqlite3CodecAttach(sqlite3* db, int nDb, const void *zKey, int nKey) {
/* point the internal codec argument against the contet to be prepared */
rc = sqlcipher_codec_ctx_init(&ctx, pDb, pDb->pBt->pBt->pPager, fd, zKey, nKey);
if(rc != SQLITE_OK) return rc; /* initialization failed, do not attach potentially corrupted context */
if(rc != SQLITE_OK) {
/* initialization failed, do not attach potentially corrupted context */
sqlite3_mutex_leave(db->mutex);
return rc;
}
sqlite3pager_sqlite3PagerSetCodec(sqlite3BtreePager(pDb->pBt), sqlite3Codec, NULL, sqlite3FreeCodecArg, (void *) ctx);