enh: handle memory leak when error occurs
This commit is contained in:
parent
ac8f72dcaf
commit
20d9befb9b
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue