fix(tdb/btree): null txn in btc

This commit is contained in:
Minglei Jin 2024-08-07 09:17:16 +08:00
parent a4ddc6c6e6
commit de2e62522a
1 changed files with 2 additions and 0 deletions

View File

@ -1660,12 +1660,14 @@ int tdbBtcOpen(SBTC *pBtc, SBTree *pBt, TXN *pTxn) {
if (pTxn == NULL) { if (pTxn == NULL) {
TXN *pTxn = tdbOsCalloc(1, sizeof(*pTxn)); TXN *pTxn = tdbOsCalloc(1, sizeof(*pTxn));
if (!pTxn) { if (!pTxn) {
pBtc->pTxn = NULL;
return terrno; return terrno;
} }
int32_t ret = tdbTxnOpen(pTxn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, 0); int32_t ret = tdbTxnOpen(pTxn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, 0);
if (ret < 0) { if (ret < 0) {
tdbOsFree(pTxn); tdbOsFree(pTxn);
pBtc->pTxn = NULL;
return ret; return ret;
} }