fix mem leak

This commit is contained in:
yihaoDeng 2023-02-10 19:24:26 +08:00
parent 9d8e3e0c8f
commit 93c61f82c9
2 changed files with 12 additions and 6 deletions

View File

@ -277,7 +277,7 @@ static SSdbRow *mndIdxActionDecode(SSdbRaw *pRaw) {
_OVER: _OVER:
if (terrno != 0) { if (terrno != 0) {
taosMemoryFreeClear(pRow); sdbFreeRaw(pRaw);
return NULL; return NULL;
} }
@ -780,15 +780,16 @@ int32_t mndAddIndexImpl(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pSt
if (mndSetUpdateIdxStbCommitLogs(pMnode, pTrans, pStb, &newStb, pIdx->colName, 1) != 0) goto _OVER; if (mndSetUpdateIdxStbCommitLogs(pMnode, pTrans, pStb, &newStb, pIdx->colName, 1) != 0) goto _OVER;
if (mndSetCreateIdxRedoActions(pMnode, pTrans, pDb, &newStb, pIdx) != 0) goto _OVER; if (mndSetCreateIdxRedoActions(pMnode, pTrans, pDb, &newStb, pIdx) != 0) goto _OVER;
// if (mndSetAlterStbRedoLogs(pMnode, pTrans, pDb, pStb) != 0) goto _OVER;
// if (mndSetAlterStbCommitLogs(pMnode, pTrans, pDb, pStb) != 0) goto _OVER;
// if (mndSetAlterStbRedoActions2(pMnode, pTrans, pDb, pStb, sql, len) != 0) goto _OVER;
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
return code; code = 0;
_OVER: _OVER:
// mndDestoryIdxObj(pIdx); // mndDestoryIdxObj(pIdx);
if (newStb.pTags != NULL) {
taosMemoryFree(newStb.pTags);
taosMemoryFree(newStb.pColumns);
}
mndTransDrop(pTrans); mndTransDrop(pTrans);
return code; return code;
} }
@ -872,6 +873,11 @@ static int32_t mndDropIdx(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SIdxObj *p
code = 0; code = 0;
_OVER: _OVER:
if (newObj.pTags != NULL) {
taosMemoryFree(newObj.pTags);
taosMemoryFree(newObj.pColumns);
}
mndTransDrop(pTrans); mndTransDrop(pTrans);
mndReleaseStb(pMnode, pStb); mndReleaseStb(pMnode, pStb);
return code; return code;

View File

@ -7,7 +7,7 @@ print ======== step0
$dbPrefix = ta_3_db $dbPrefix = ta_3_db
$tbPrefix = ta_3_tb $tbPrefix = ta_3_tb
$mtPrefix = ta_3_mt $mtPrefix = ta_3_mt
$tbNum = 100 $tbNum = 10
$rowNum = 20 $rowNum = 20
$totalNum = 200 $totalNum = 200