diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 954c3483a9..eb11308330 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -548,7 +548,6 @@ struct SSchemaExt { uint32_t compress; }; - // struct SSchema2 { @@ -2810,6 +2809,7 @@ static FORCE_INLINE void tdDestroySVCreateTbReq(SVCreateTbReq* req) { } else if (req->type == TSDB_NORMAL_TABLE) { taosMemoryFreeClear(req->ntb.schemaRow.pSchema); } + taosMemoryFreeClear(req->colCmpr.pColCmpr); } typedef struct { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 73140952a2..f3b87ebc78 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -8348,6 +8348,7 @@ void tFreeSMAlterStbRsp(SMAlterStbRsp *pRsp) { if (pRsp->pMeta) { taosMemoryFree(pRsp->pMeta->pSchemas); + taosMemoryFree(pRsp->pMeta->pSchemaExt); taosMemoryFree(pRsp->pMeta); } } diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c index 2bf73198aa..3432153cae 100644 --- a/source/dnode/vnode/src/meta/metaQuery.c +++ b/source/dnode/vnode/src/meta/metaQuery.c @@ -63,6 +63,7 @@ int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t u if (metaDecodeEntry(&pReader->coder, &pReader->me) < 0) { goto _err; } + taosMemoryFreeClear(pReader->me.colCmpr.pColCmpr); return 0; @@ -361,6 +362,7 @@ _query: version = ((SUidIdxVal *)pData)[0].version; tdbTbGet(pMeta->pTbDb, &(STbDbKey){.uid = uid, .version = version}, sizeof(STbDbKey), &pData, &nData); + SMetaEntry me = {0}; tDecoderInit(&dc, pData, nData); metaDecodeEntry(&dc, &me); @@ -368,6 +370,7 @@ _query: if (sver == -1 || sver == me.stbEntry.schemaRow.version) { pSchema = tCloneSSchemaWrapper(&me.stbEntry.schemaRow); tDecoderClear(&dc); + taosMemoryFree(me.colCmpr.pColCmpr); goto _exit; } } else if (me.type == TSDB_CHILD_TABLE) { @@ -378,10 +381,12 @@ _query: if (sver == -1 || sver == me.ntbEntry.schemaRow.version) { pSchema = tCloneSSchemaWrapper(&me.ntbEntry.schemaRow); tDecoderClear(&dc); + taosMemoryFree(me.colCmpr.pColCmpr); goto _exit; } } tDecoderClear(&dc); + taosMemoryFree(me.colCmpr.pColCmpr); // query from skm db if (tdbTbGet(pMeta->pSkmDb, &(SSkmDbKey){.uid = uid, .sver = sver}, sizeof(SSkmDbKey), &pData, &nData) < 0) { @@ -408,9 +413,8 @@ _err: return NULL; } - -SMCtbCursor *metaOpenCtbCursor(void* pVnode, tb_uid_t uid, int lock) { - SMeta* pMeta = ((SVnode*)pVnode)->pMeta; +SMCtbCursor *metaOpenCtbCursor(void *pVnode, tb_uid_t uid, int lock) { + SMeta *pMeta = ((SVnode *)pVnode)->pMeta; SMCtbCursor *pCtbCur = NULL; SCtbIdxKey ctbIdxKey; int ret = 0; @@ -447,9 +451,9 @@ void metaCloseCtbCursor(SMCtbCursor *pCtbCur) { taosMemoryFree(pCtbCur); } -void metaPauseCtbCursor(SMCtbCursor* pCtbCur) { +void metaPauseCtbCursor(SMCtbCursor *pCtbCur) { if (!pCtbCur->paused) { - tdbTbcClose((TBC*)pCtbCur->pCur); + tdbTbcClose((TBC *)pCtbCur->pCur); if (pCtbCur->lock) { metaULock(pCtbCur->pMeta); } @@ -457,7 +461,7 @@ void metaPauseCtbCursor(SMCtbCursor* pCtbCur) { } } -int32_t metaResumeCtbCursor(SMCtbCursor* pCtbCur, int8_t first) { +int32_t metaResumeCtbCursor(SMCtbCursor *pCtbCur, int8_t first) { if (pCtbCur->paused) { pCtbCur->paused = 0; @@ -465,14 +469,14 @@ int32_t metaResumeCtbCursor(SMCtbCursor* pCtbCur, int8_t first) { metaRLock(pCtbCur->pMeta); } int ret = 0; - ret = tdbTbcOpen(pCtbCur->pMeta->pCtbIdx, (TBC**)&pCtbCur->pCur, NULL); + ret = tdbTbcOpen(pCtbCur->pMeta->pCtbIdx, (TBC **)&pCtbCur->pCur, NULL); if (ret < 0) { metaCloseCtbCursor(pCtbCur); return -1; } if (first) { - SCtbIdxKey ctbIdxKey; + SCtbIdxKey ctbIdxKey; // move to the suid ctbIdxKey.suid = pCtbCur->suid; ctbIdxKey.uid = INT64_MIN; @@ -1476,23 +1480,23 @@ int32_t metaGetInfo(SMeta *pMeta, int64_t uid, SMetaInfo *pInfo, SMetaReader *pR lock = 1; } - if(!lock) metaRLock(pMeta); + if (!lock) metaRLock(pMeta); // search cache if (metaCacheGet(pMeta, uid, pInfo) == 0) { - if(!lock) metaULock(pMeta); + if (!lock) metaULock(pMeta); goto _exit; } // search TDB if (tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData) < 0) { // not found - if(!lock) metaULock(pMeta); + if (!lock) metaULock(pMeta); code = TSDB_CODE_NOT_FOUND; goto _exit; } - if(!lock) metaULock(pMeta); + if (!lock) metaULock(pMeta); pInfo->uid = uid; pInfo->suid = ((SUidIdxVal *)pData)->suid; diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 8f701da139..a5bbc06b25 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -2562,6 +2562,7 @@ int32_t metaGetColCmpr(SMeta *pMeta, tb_uid_t uid, SHashObj **ppColCmprObj) { return 0; } tDecoderClear(&dc); + taosMemoryFree(e.colCmpr.pColCmpr); tdbFree(pData); metaULock(pMeta); diff --git a/source/dnode/vnode/src/tsdb/tsdbFSetRW.c b/source/dnode/vnode/src/tsdb/tsdbFSetRW.c index a85af84abf..5ab2b91b21 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFSetRW.c +++ b/source/dnode/vnode/src/tsdb/tsdbFSetRW.c @@ -127,6 +127,7 @@ _exit: if (code) { TSDB_ERROR_LOG(TD_VID(writer->config->tsdb->pVnode), lino, code); } + taosHashCleanup(writer->pColCmprObj); return code; }