From b2c0bcb1e0480d968e45b5cac1c24ce34a4e6959 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 28 Jun 2023 13:35:14 +0800 Subject: [PATCH] tdb/ofp-recycle: fix mem leaks --- source/libs/tdb/src/db/tdbBtree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 65d1c30328..ef9aaa4571 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -233,6 +233,7 @@ int tdbBtreeDelete(SBTree *pBt, const void *pKey, int kLen, TXN *pTxn) { int ret; tdbBtcOpen(&btc, pBt, pTxn); + btc.coder.ofps = taosArrayInit(8, sizeof(SPgno)); tdbTrace("tdb delete, btc: %p, pTxn: %p", &btc, pTxn); @@ -1317,10 +1318,9 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader, return -1; } - if (!pDecoder->ofps) { - pDecoder->ofps = taosArrayInit(8, sizeof(SPgno)); + if (pDecoder->ofps) { + taosArrayPush(pDecoder->ofps, &pgno); } - taosArrayPush(pDecoder->ofps, &pgno); ofpCell = tdbPageGetCell(ofp, 0); -- GitLab