1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Make sure all virtual table cursors have been closed on a prepared statement

prior to unlinking the perpared statement from its database connection.

FossilOrigin-Name: f7c5abe8739090db0738d2c7002a0d71f76c927e
This commit is contained in:
drh
2012-10-26 00:11:23 +00:00
parent e62c0694de
commit cb103b9274
5 changed files with 22 additions and 17 deletions

View File

@@ -2434,12 +2434,14 @@ void sqlite3VdbeDeleteAuxData(VdbeFunc *pVdbeFunc, int mask){
}
/*
** Free all memory associated with the Vdbe passed as the second argument.
** Free all memory associated with the Vdbe passed as the second argument,
** except for object itself, which is preserved.
**
** The difference between this function and sqlite3VdbeDelete() is that
** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with
** the database connection.
** the database connection and frees the object itself.
*/
void sqlite3VdbeDeleteObject(sqlite3 *db, Vdbe *p){
void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
SubProgram *pSub, *pNext;
int i;
assert( p->db==0 || p->db==db );
@@ -2460,7 +2462,6 @@ void sqlite3VdbeDeleteObject(sqlite3 *db, Vdbe *p){
sqlite3DbFree(db, p->zExplain);
sqlite3DbFree(db, p->pExplain);
#endif
sqlite3DbFree(db, p);
}
/*
@@ -2472,6 +2473,7 @@ void sqlite3VdbeDelete(Vdbe *p){
if( NEVER(p==0) ) return;
db = p->db;
assert( sqlite3_mutex_held(db->mutex) );
sqlite3VdbeClearObject(db, p);
if( p->pPrev ){
p->pPrev->pNext = p->pNext;
}else{
@@ -2483,7 +2485,7 @@ void sqlite3VdbeDelete(Vdbe *p){
}
p->magic = VDBE_MAGIC_DEAD;
p->db = 0;
sqlite3VdbeDeleteObject(db, p);
sqlite3DbFree(db, p);
}
/*