diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 7a62b38b16..543e06aae6 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -2473,6 +2473,10 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { } int tdbBtcClose(SBTC *pBtc) { + if (pBtc->freeTxn) { + tdbTxnClose(pBtc->pTxn); + } + if (pBtc->iPage < 0) return 0; for (;;) { @@ -2496,10 +2500,6 @@ int tdbBtcClose(SBTC *pBtc) { tdbFree(pBtc->coder.pVal); } - if (pBtc->freeTxn) { - tdbTxnClose(pBtc->pTxn); - } - return 0; }