8000 Prevent deadlock of database mutex · githubzhaoliang/sqlcipher@e873a49 · GitHub
[go: up one dir, main page]

Skip to content

Commit e873a49

Browse files
Prevent deadlock of database mutex
1 parent d7120d7 commit e873a49

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/crypto.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,11 @@ int sqlite3CodecAttach(sqlite3* db, int nDb, const void *zKey, int nKey) {
365365
/* point the internal codec argument against the contet to be prepared */
366366
rc = sqlcipher_codec_ctx_init(&ctx, pDb, pDb->pBt->pBt->pPager, fd, zKey, nKey);
367367

368-
if(rc != SQLITE_OK) return rc; /* initialization failed, do not attach potentially corrupted context */
368+
if(rc != SQLITE_OK) {
369+
/* initialization failed, do not attach potentially corrupted context */
370+
sqlite3_mutex_leave(db->mutex);
371+
return rc;
372+
}
369373

370374
sqlite3pager_sqlite3PagerSetCodec(sqlite3BtreePager(pDb->pBt), sqlite3Codec, NULL, sqlite3FreeCodecArg, (void *) ctx);
371375

0 commit comments

Comments
 (0)
0