fix(query): fix memory leak.

This commit is contained in:
Haojun Liao 2022-11-26 00:58:29 +08:00
parent c6795b68d2
commit 802ca0f607
2 changed files with 8 additions and 0 deletions

View File

@ -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;

View File

@ -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));
}