1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Skip calling the virtual table xDestroy method when it is null.

FossilOrigin-Name: b73ad305a6b7cb84fe0a1efb334b8e4592e21c40
This commit is contained in:
mistachkin
2015-08-20 21:14:31 +00:00
parent bc63ec1d62
commit 197d59ffc4
3 changed files with 10 additions and 8 deletions

View File

@@ -801,6 +801,7 @@ int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){
pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);
if( ALWAYS(pTab!=0 && pTab->pVTable!=0) ){
VTable *p;
int (*xDestroy)(sqlite3_vtab *);
for(p=pTab->pVTable; p; p=p->pNext){
assert( p->pVtab );
if( p->pVtab->nRef>0 ){
@@ -808,7 +809,8 @@ int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){
}
}
p = vtabDisconnectAll(db, pTab);
rc = p->pMod->pModule->xDestroy(p->pVtab);
xDestroy = p->pMod->pModule->xDestroy;
rc = xDestroy ? xDestroy(p->pVtab) : SQLITE_OK;
/* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */
if( rc==SQLITE_OK ){
assert( pTab->pVTable==p && p->pNext==0 );