From ebd02be60d827883cb59ca1dbac10c8814266148 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 20 Jul 2022 10:50:26 +0800 Subject: [PATCH] fix: definite lost while get sma meta --- include/common/tmsg.h | 1 + source/common/src/tmsg.c | 7 +++++++ source/dnode/mnode/impl/src/mndSma.c | 1 + tests/script/tsim/valgrind/checkError6.sim | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 2f4c80f025..3e27bd9268 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -2803,6 +2803,7 @@ typedef struct { int32_t tSerializeSTableIndexRsp(void* buf, int32_t bufLen, const STableIndexRsp* pRsp); int32_t tDeserializeSTableIndexRsp(void* buf, int32_t bufLen, STableIndexRsp* pRsp); +void tFreeSerializeSTableIndexRsp(STableIndexRsp* pRsp); void tFreeSTableIndexInfo(void* pInfo); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index b79c412914..43003e7fab 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -2933,6 +2933,13 @@ int32_t tSerializeSTableIndexRsp(void *buf, int32_t bufLen, const STableIndexRsp return tlen; } +void tFreeSerializeSTableIndexRsp(STableIndexRsp *pRsp) { + if (pRsp->pIndex != NULL) { + taosArrayDestroy(pRsp->pIndex); + pRsp->pIndex = NULL; + } +} + int32_t tDeserializeSTableIndexInfo(SDecoder *pDecoder, STableIndexInfo *pInfo) { if (tDecodeI8(pDecoder, &pInfo->intervalUnit) < 0) return -1; if (tDecodeI8(pDecoder, &pInfo->slidingUnit) < 0) return -1; diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index bff3f19e99..e82e5e0870 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -1153,6 +1153,7 @@ _OVER: mError("failed to get table index %s since %s", indexReq.tbFName, terrstr()); } + tFreeSerializeSTableIndexRsp(&rsp); return code; } diff --git a/tests/script/tsim/valgrind/checkError6.sim b/tests/script/tsim/valgrind/checkError6.sim index 2783e94771..a9f66647f9 100644 --- a/tests/script/tsim/valgrind/checkError6.sim +++ b/tests/script/tsim/valgrind/checkError6.sim @@ -68,7 +68,7 @@ $null= system_content sh/checkValgrind.sh -n dnode1 print cmd return result ----> [ $system_content ] -if $system_content > 3 then +if $system_content > 0 then return -1 endi