fix mem leak

This commit is contained in:
yihaoDeng 2023-02-12 10:30:36 +08:00
parent 93c61f82c9
commit a8b0452080
2 changed files with 8 additions and 12 deletions

View File

@ -277,11 +277,11 @@ static SSdbRow *mndIdxActionDecode(SSdbRaw *pRaw) {
_OVER: _OVER:
if (terrno != 0) { if (terrno != 0) {
sdbFreeRaw(pRaw); sdbFreeRaw(pRow);
return NULL; return NULL;
} }
mTrace("sma:%s, decode from raw:%p, row:%p", pIdx->name, pRaw, pIdx); mTrace("idx:%s, decode from raw:%p, row:%p", pIdx->name, pRaw, pIdx);
return pRow; return pRow;
} }
@ -291,12 +291,12 @@ static int32_t mndIdxActionInsert(SSdb *pSdb, SIdxObj *pIdx) {
} }
static int32_t mndIdxActionDelete(SSdb *pSdb, SIdxObj *pIdx) { static int32_t mndIdxActionDelete(SSdb *pSdb, SIdxObj *pIdx) {
mTrace("sma:%s, perform delete action, row:%p", pIdx->name, pIdx); mTrace("idx:%s, perform delete action, row:%p", pIdx->name, pIdx);
return 0; return 0;
} }
static int32_t mndIdxActionUpdate(SSdb *pSdb, SIdxObj *pOld, SIdxObj *pNew) { static int32_t mndIdxActionUpdate(SSdb *pSdb, SIdxObj *pOld, SIdxObj *pNew) {
mTrace("sma:%s, perform update action, old row:%p new row:%p", pOld->name, pOld, pNew); mTrace("idx:%s, perform update action, old row:%p new row:%p", pOld->name, pOld, pNew);
return 0; return 0;
} }
@ -873,10 +873,8 @@ 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.pTags); taosMemoryFree(newObj.pColumns);
taosMemoryFree(newObj.pColumns);
}
mndTransDrop(pTrans); mndTransDrop(pTrans);
mndReleaseStb(pMnode, pStb); mndReleaseStb(pMnode, pStb);
@ -898,8 +896,6 @@ int32_t mndProcessDropTagIdxReq(SRpcMsg *pReq) {
if (mndAcquireGlobalIdx(pMnode, req.name, SDB_IDX, &idx) == 0) { if (mndAcquireGlobalIdx(pMnode, req.name, SDB_IDX, &idx) == 0) {
pIdx = idx.pIdx; pIdx = idx.pIdx;
} }
pIdx = mndAcquireIdx(pMnode, req.name);
if (pIdx == NULL) { if (pIdx == NULL) {
if (req.igNotExists) { if (req.igNotExists) {
mInfo("idx:%s, not exist, ignore not exist is set", req.name); mInfo("idx:%s, not exist, ignore not exist is set", req.name);
@ -923,12 +919,13 @@ int32_t mndProcessDropTagIdxReq(SRpcMsg *pReq) {
code = mndDropIdx(pMnode, pReq, pDb, pIdx); code = mndDropIdx(pMnode, pReq, pDb, pIdx);
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
return code;
_OVER: _OVER:
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
mError("idx:%s, failed to drop since %s", req.name, terrstr()); mError("idx:%s, failed to drop since %s", req.name, terrstr());
} }
mndReleaseIdx(pMnode, pIdx);
mndReleaseDb(pMnode, pDb);
return code; return code;
} }
static int32_t mndProcessGetIdxReq(SRpcMsg *pReq) { static int32_t mndProcessGetIdxReq(SRpcMsg *pReq) {

View File

@ -63,7 +63,6 @@ static int32_t mndProcessDropIdxReq(SRpcMsg *pReq) {
if (terrno == TSDB_CODE_MND_SMA_NOT_EXIST) { if (terrno == TSDB_CODE_MND_SMA_NOT_EXIST) {
terrno = 0; terrno = 0;
ret = mndProcessDropTagIdxReq(pReq); ret = mndProcessDropTagIdxReq(pReq);
} else {
} }
return ret; return ret;
} }