From ed3778dc9f11cd4dc6613303e06309bb05442eba Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 17 Apr 2023 15:44:15 +0800 Subject: [PATCH] fix: nodes free issue --- include/libs/nodes/nodes.h | 1 + source/libs/executor/src/executil.c | 2 +- source/libs/nodes/src/nodesUtilFuncs.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index a2e4c76adc..f8d6f1dcf9 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -306,6 +306,7 @@ void nodesDestroyAllocator(int64_t allocatorId); SNode* nodesMakeNode(ENodeType type); void nodesDestroyNode(SNode* pNode); +void nodesFree(void* p); SNodeList* nodesMakeList(); int32_t nodesListAppend(SNodeList* pList, SNode* pNode); diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index dc244acb40..2716f7fd7d 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -486,7 +486,7 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis SNodeListNode* listNode = (SNodeListNode*)nodesMakeNode(QUERY_NODE_NODE_LIST); listNode->pNodeList = group; genTagFilterDigest((SNode *)listNode, &context); - taosMemoryFree(listNode); + nodesFree(listNode); if (lastTableList && (0 == memcmp(context.digest, lastMd5.digest, sizeof(lastMd5.digest)) && (taosArrayGetSize(pTableListInfo->pTableList) == taosArrayGetSize(lastTableList)))) { pTableListInfo->pTableList = taosArrayDup(lastTableList, NULL); diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index eff69e9764..35860196e4 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -87,7 +87,7 @@ static void* nodesCalloc(int32_t num, int32_t size) { return (char*)p + 1; } -static void nodesFree(void* p) { +void nodesFree(void* p) { char* ptr = (char*)p - 1; if (0 == *ptr) { taosMemoryFree(ptr); -- GitLab