Index: src/btree_rb.c ================================================================== --- src/btree_rb.c +++ src/btree_rb.c @@ -7,11 +7,11 @@ ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree_rb.c,v 1.13 2003/06/10 02:46:15 drh Exp $ +** $Id: btree_rb.c,v 1.14 2003/06/29 18:29:48 drh Exp $ ** ** This file implements an in-core database using Red-Black balanced ** binary trees. ** ** It was contributed to SQLite by anonymous on 2003-Feb-04 23:24:49 UTC. @@ -1178,25 +1178,10 @@ } return msg; } -/* - * Close the supplied Rbtree. Delete everything associated with it. - */ -static int memRbtreeClose(Rbtree* tree) -{ - HashElem *p; - while( (p=sqliteHashFirst(&tree->tblHash))!=0 ){ - tree->eTransState = TRANS_ROLLBACK; - memRbtreeDropTable(tree, sqliteHashKeysize(p)); - } - sqliteHashClear(&tree->tblHash); - sqliteFree(tree); - return SQLITE_OK; -} - static int memRbtreeSetCacheSize(Rbtree* tree, int sz) { return SQLITE_OK; } @@ -1235,10 +1220,26 @@ tree->pCheckRollback = 0; tree->pCheckRollbackTail = 0; tree->eTransState = TRANS_NONE; return SQLITE_OK; } + +/* + * Close the supplied Rbtree. Delete everything associated with it. + */ +static int memRbtreeClose(Rbtree* tree) +{ + HashElem *p; + memRbtreeCommit(tree); + while( (p=sqliteHashFirst(&tree->tblHash))!=0 ){ + tree->eTransState = TRANS_ROLLBACK; + memRbtreeDropTable(tree, sqliteHashKeysize(p)); + } + sqliteHashClear(&tree->tblHash); + sqliteFree(tree); + return SQLITE_OK; +} /* * Execute and delete the supplied rollback-list on pRbtree. */ static void execute_rollback_list(Rbtree *pRbtree, BtRollbackOp *pList)