1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Avoid a crash that could occur when a database containing a table with a temp trigger that has the same name as a temp table is detached.

FossilOrigin-Name: c4cb9708d48ead10ee9543f86878be8382cd6e850950d5384c95254bac4a8d6e
This commit is contained in:
dan
2019-12-03 03:34:06 +00:00
parent d79967adbe
commit 0232dade79
4 changed files with 35 additions and 11 deletions

View File

@@ -662,8 +662,12 @@ void sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const char *zName){
Table *pTab = tableOfTrigger(pTrigger);
if( pTab ){
Trigger **pp;
for(pp=&pTab->pTrigger; *pp!=pTrigger; pp=&((*pp)->pNext));
*pp = (*pp)->pNext;
for(pp=&pTab->pTrigger; *pp; pp=&((*pp)->pNext)){
if( *pp==pTrigger ){
*pp = (*pp)->pNext;
break;
}
}
}
}
sqlite3DeleteTrigger(db, pTrigger);