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

Better fix than (3860) for the same problem. (3860) could leave file-handles open in some circumstances. (CVS 3861)

FossilOrigin-Name: 5ad645339b2a3a280651447dceda67645ff8e96d
This commit is contained in:
danielk1977
2007-04-19 14:48:37 +00:00
parent 4ea0d2e528
commit 0b83fa8297
3 changed files with 19 additions and 17 deletions

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to help implement virtual tables.
**
** $Id: vtab.c,v 1.44 2007/04/19 14:28:09 danielk1977 Exp $
** $Id: vtab.c,v 1.45 2007/04/19 14:48:37 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"
@@ -533,16 +533,18 @@ int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab)
*/
static void callFinaliser(sqlite3 *db, int offset){
int i;
for(i=0; i<db->nVTrans && db->aVTrans && db->aVTrans[i]; i++){
sqlite3_vtab *pVtab = db->aVTrans[i];
int (*x)(sqlite3_vtab *);
x = *(int (**)(sqlite3_vtab *))((char *)pVtab->pModule + offset);
if( x ) x(pVtab);
sqlite3VtabUnlock(db, pVtab);
if( db->aVTrans ){
for(i=0; i<db->nVTrans && db->aVTrans[i]; i++){
sqlite3_vtab *pVtab = db->aVTrans[i];
int (*x)(sqlite3_vtab *);
x = *(int (**)(sqlite3_vtab *))((char *)pVtab->pModule + offset);
if( x ) x(pVtab);
sqlite3VtabUnlock(db, pVtab);
}
sqliteFree(db->aVTrans);
db->nVTrans = 0;
db->aVTrans = 0;
}
sqliteFree(db->aVTrans);
db->nVTrans = 0;
db->aVTrans = 0;
}
/*