btc/close: free txn only if iPage < 0
This commit is contained in:
parent
d5f140aee2
commit
785faf50aa
|
@ -2473,12 +2473,13 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int tdbBtcClose(SBTC *pBtc) {
|
int tdbBtcClose(SBTC *pBtc) {
|
||||||
if (pBtc->freeTxn) {
|
if (pBtc->iPage < 0) {
|
||||||
tdbTxnClose(pBtc->pTxn);
|
if (pBtc->freeTxn) {
|
||||||
|
tdbTxnClose(pBtc->pTxn);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pBtc->iPage < 0) return 0;
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (NULL == pBtc->pPage) {
|
if (NULL == pBtc->pPage) {
|
||||||
tdbError("tdb/btc-close: null ptr pPage.");
|
tdbError("tdb/btc-close: null ptr pPage.");
|
||||||
|
@ -2500,6 +2501,10 @@ int tdbBtcClose(SBTC *pBtc) {
|
||||||
tdbFree(pBtc->coder.pVal);
|
tdbFree(pBtc->coder.pVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pBtc->freeTxn) {
|
||||||
|
tdbTxnClose(pBtc->pTxn);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue