mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Fix a problem allowing a Table object to be deleted from within a call to the xDestroy method of the associated virtual table, causing a use-after-free error.
FossilOrigin-Name: 1dbbb0101e8213b92b9a4c78c0fd2f9d0240a8ea3b40dff1033d1b8d71fb04ef
This commit is contained in:
@@ -841,6 +841,7 @@ int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){
|
||||
p = vtabDisconnectAll(db, pTab);
|
||||
xDestroy = p->pMod->pModule->xDestroy;
|
||||
assert( xDestroy!=0 ); /* Checked before the virtual table is created */
|
||||
pTab->nTabRef++;
|
||||
rc = xDestroy(p->pVtab);
|
||||
/* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */
|
||||
if( rc==SQLITE_OK ){
|
||||
@@ -849,6 +850,7 @@ int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){
|
||||
pTab->pVTable = 0;
|
||||
sqlite3VtabUnlock(p);
|
||||
}
|
||||
sqlite3DeleteTable(db, pTab);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
Reference in New Issue
Block a user