From dbeafb508b1895144942de6fbd4414d3d759f91a Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 29 Aug 2023 17:56:24 +0800 Subject: [PATCH] fix: reset show obj iter on no more data to read in mndRetrieveIdx --- source/dnode/mnode/impl/src/mndSma.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index d666f80fd3..44842084c5 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -1324,7 +1324,14 @@ static int32_t mndRetrieveIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter)); } int32_t read = mndRetrieveSma(pReq, pShow, pBlock, rows); - if (read < rows) read += mndRetrieveTagIdx(pReq, pShow, pBlock, rows - read); + if (read < rows) { + read += mndRetrieveTagIdx(pReq, pShow, pBlock, rows - read); + } + // no more to read + if (read < rows) { + taosMemoryFree(pShow->pIter); + pShow->pIter = NULL; + } return read; } static void mndCancelRetrieveIdx(SMnode *pMnode, void *pIter) {