From 802ca0f607ff7d8241ebf0765f04987f710f6bf9 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 26 Nov 2022 00:58:29 +0800 Subject: [PATCH] fix(query): fix memory leak. --- source/dnode/vnode/src/meta/metaCache.c | 7 +++++++ source/libs/executor/src/executil.c | 1 + 2 files changed, 8 insertions(+) diff --git a/source/dnode/vnode/src/meta/metaCache.c b/source/dnode/vnode/src/meta/metaCache.c index 4aa6ed3744..45f70e1c92 100644 --- a/source/dnode/vnode/src/meta/metaCache.c +++ b/source/dnode/vnode/src/meta/metaCache.c @@ -90,6 +90,12 @@ static void statsCacheClose(SMeta* pMeta) { } } +static void freeCacheEntryFp(void* param) { + STagFilterResEntry** p = param; + tdListEmpty(&(*p)->list); + taosMemoryFreeClear(*p); +} + int32_t metaCacheOpen(SMeta* pMeta) { int32_t code = 0; SMetaCache* pCache = NULL; @@ -132,6 +138,7 @@ int32_t metaCacheOpen(SMeta* pMeta) { goto _err2; } + taosHashSetFreeFp(pCache->sTagFilterResCache.pTableEntry, freeCacheEntryFp); pMeta->pCache = pCache; return code; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 6ee2dce59b..21fba22af4 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -1017,6 +1017,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode, metaUidFilterCachePut(metaHandle, pScanNode->suid, context.digest, tListLen(context.digest), pPayload, size, 1); + taosMemoryFree(pPayload); } else { qDebug("retrieve table uid list from cache, numOfTables:%d", (int32_t) taosArrayGetSize(res)); } -- GitLab