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

When trying to drop a virtual table that has no xDestroy method, invoke

the xDisconnect method rather than doing nothing, to avoid a memory leak.

FossilOrigin-Name: 1fa29a5f2a89b6a1ee067f9cb86de1b66455126349efe3502599fc7ad224170c
This commit is contained in:
drh
2019-12-11 15:07:09 +00:00
parent 31046a9f1f
commit a1ca00edd5
3 changed files with 10 additions and 8 deletions

View File

@@ -892,8 +892,10 @@ int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){
}
p = vtabDisconnectAll(db, pTab);
xDestroy = p->pMod->pModule->xDestroy;
if( xDestroy==0 ) xDestroy = p->pMod->pModule->xDisconnect;
assert( xDestroy!=0 );
pTab->nTabRef++;
rc = xDestroy ? xDestroy(p->pVtab) : SQLITE_OK;
rc = xDestroy(p->pVtab);
/* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */
if( rc==SQLITE_OK ){
assert( pTab->pVTable==p && p->pNext==0 );