aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-12-11 15:07:09 +0000
committerdrh <drh@noemail.net>2019-12-11 15:07:09 +0000
commita1ca00edd5e4d8278251d0498b0cf761931d86d2 (patch)
treea062bf31f8d068b3e2da045e06541d4b675307a3 /src
parent31046a9f1ff573fc435bf9c5319ec101a91c57c1 (diff)
downloadsqlite-a1ca00edd5e4d8278251d0498b0cf761931d86d2.tar.gz
sqlite-a1ca00edd5e4d8278251d0498b0cf761931d86d2.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/vtab.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vtab.c b/src/vtab.c
index 3fcfaea1c..64125e769 100644
--- a/src/vtab.c
+++ b/src/vtab.c
@@ -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 );