diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c index 3f6d17a5a7..14207e7fb3 100644 --- a/source/dnode/vnode/src/meta/metaQuery.c +++ b/source/dnode/vnode/src/meta/metaQuery.c @@ -62,7 +62,10 @@ int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t u tDecoderInit(&pReader->coder, pReader->pBuf, pReader->szBuf); code = metaDecodeEntry(&pReader->coder, &pReader->me); - if (code) return code; + if (code) { + tDecoderClear(&pReader->coder); + return code; + } // taosMemoryFreeClear(pReader->me.colCmpr.pColCmpr); return 0; @@ -393,6 +396,7 @@ _query: tDecoderInit(&dc, pData, nData); int32_t code = metaDecodeEntry(&dc, &me); if (code) { + tDecoderClear(&dc); goto _err; } if (me.type == TSDB_SUPER_TABLE) { @@ -1277,7 +1281,11 @@ int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *arg, SArray *pUids) { tDecoderInit(&dc, pData, nData); - TAOS_CHECK_GOTO(metaDecodeEntry(&dc, &oStbEntry), NULL, END); + code = metaDecodeEntry(&dc, &oStbEntry); + if (code) { + tDecoderClear(&dc); + goto END; + } if (oStbEntry.stbEntry.schemaTag.pSchema == NULL || oStbEntry.stbEntry.schemaTag.pSchema == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_INVALID_PARA, NULL, END); diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c index ecd5feeb10..0936d8f092 100644 --- a/source/dnode/vnode/src/meta/metaSnapshot.c +++ b/source/dnode/vnode/src/meta/metaSnapshot.c @@ -605,6 +605,7 @@ int32_t getTableInfoFromSnapshot(SSnapContext* ctx, void** pBuf, int32_t* contLe tDecoderInit(&dc, pVal, vLen); ret = metaDecodeEntry(&dc, &me); if (ret < 0) { + tDecoderClear(&dc); ret = TAOS_GET_TERRNO(ret); goto END; } diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index d489535c02..8814e87140 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -565,6 +565,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { if (ret < 0) { metaError("vgId:%d, failed to decode stb:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name, pReq->suid, tstrerror(ret)); + tDecoderClear(&dc); tdbTbcClose(pTbDbc); tdbTbcClose(pUidIdxc); return terrno; @@ -1504,6 +1505,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p tDecoderInit(&tdc, tData, tLen); int32_t ret = metaDecodeEntry(&tdc, &stbEntry); if (ret < 0) { + tDecoderClear(&tdc); metaError("vgId:%d, failed to decode child table:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.ctbEntry.suid, tstrerror(ret)); return ret; @@ -2399,6 +2401,7 @@ static int metaAddTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTb tDecoderInit(&dc, pVal, nVal); ret = metaDecodeEntry(&dc, &stbEntry); if (ret < 0) { + tDecoderClear(&dc); goto _err; } @@ -2540,6 +2543,7 @@ static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterT tDecoderInit(&dc, pVal, nVal); ret = metaDecodeEntry(&dc, &stbEntry); if (ret < 0) { + tDecoderClear(&dc); goto _err; }