diff --git a/include/common/common.h b/include/common/common.h index bbde65b48fa8eb5ae0d1f9cda27a88cfb44373d6..092a666e73c80bea2c75befa28dad08a5da48555 100644 --- a/include/common/common.h +++ b/include/common/common.h @@ -174,6 +174,24 @@ static FORCE_INLINE void* tDecodeSMqConsumeRsp(void* buf, SMqConsumeRsp* pRsp) { return buf; } +static FORCE_INLINE void destroySSDataBlock(SSDataBlock* pBlock) { + if (pBlock == NULL) { + return; + } + + //int32_t numOfOutput = pBlock->info.numOfCols; + int32_t sz = taosArrayGetSize(pBlock->pDataBlock); + for(int32_t i = 0; i < sz; ++i) { + SColumnInfoData* pColInfoData = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, i); + tfree(pColInfoData->pData); + } + + taosArrayDestroy(pBlock->pDataBlock); + tfree(pBlock->pBlockAgg); + tfree(pBlock); +} + + //====================================================================================================================== // the following structure shared by parser and executor typedef struct SColumn { diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index c42b023d12dff1ecd1f0fa8c14471c829abc2b31..7ef06397f0a91a9e053aec94bf38dfa7f96e6a89 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -606,7 +606,7 @@ TEST(testCase, create_topic_stb_Test) { taos_free_result(pRes); - char* sql = "select ts, k from st1"; + char* sql = "select * from st1"; pRes = taos_create_topic(pConn, "test_stb_topic_1", sql, strlen(sql)); taos_free_result(pRes); taos_close(pConn); diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index f3163fb515053a2afb27a082bb15c9191ed658aa..49d15e61488062b2d548f98df31127eac9bf0e62 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -785,6 +785,13 @@ int32_t tqProcessConsumeReq(STQ* pTq, SRpcMsg* pMsg) { } void* abuf = buf; tEncodeSMqConsumeRsp(&abuf, &rsp); + if (rsp.pBlockData) { + for (int i = 0; i < taosArrayGetSize(rsp.pBlockData); i++) { + SSDataBlock* pBlock = taosArrayGet(rsp.pBlockData, i); + destroySSDataBlock(pBlock); + } + free(rsp.pBlockData); + } pMsg->pCont = buf; pMsg->contLen = tlen; pMsg->code = 0;