From d282e511e3b30f6223f975325d138c6b81126107 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 3 Nov 2022 11:47:15 +0800 Subject: [PATCH] fix: fix taosd memory leak issue --- source/libs/executor/src/groupoperator.c | 8 ++++++++ source/libs/qworker/src/qworker.c | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 98f8d57fc6..e07a3475e0 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -750,6 +750,14 @@ static void destroyPartitionOperatorInfo(void* param) { taosArrayDestroy(pInfo->pGroupColVals); taosMemoryFree(pInfo->keyBuf); taosArrayDestroy(pInfo->sortedGroupArray); + + void* pGroupIter = taosHashIterate(pInfo->pGroupSet, NULL); + while (pGroupIter != NULL) { + SDataGroupInfo* pGroupInfo = pGroupIter; + taosArrayDestroy(pGroupInfo->pPageList); + pGroupIter = taosHashIterate(pInfo->pGroupSet, pGroupIter); + } + taosHashCleanup(pInfo->pGroupSet); taosMemoryFree(pInfo->columnOffset); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 001a1972a0..a7cd3db824 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -644,11 +644,13 @@ _return: input.msgType = qwMsg->msgType; code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_QUERY, &input, NULL); - if (ctx != NULL && QW_EVENT_RECEIVED(ctx, QW_EVENT_FETCH)) { + if (QUERY_RSP_POLICY_QUICK == tsQueryRspPolicy && ctx != NULL && QW_EVENT_RECEIVED(ctx, QW_EVENT_FETCH)) { void *rsp = NULL; int32_t dataLen = 0; SOutputData sOutput = {0}; - QW_ERR_JRET(qwGetQueryResFromSink(QW_FPARAMS(), ctx, &dataLen, &rsp, &sOutput)); + if (qwGetQueryResFromSink(QW_FPARAMS(), ctx, &dataLen, &rsp, &sOutput)) { + return TSDB_CODE_SUCCESS; + } if (rsp) { bool qComplete = (DS_BUF_EMPTY == sOutput.bufStatus && sOutput.queryEnd); -- GitLab