[TASKMGR] Fix PerfDataDeallocCommandLineCache

Do not leak memory. CORE-18014
This commit is contained in:
Katayama Hirofumi MZ 2023-06-15 15:36:19 +09:00
parent 7989e3f26c
commit 9a6c85f68a

View file

@ -649,16 +649,15 @@ cleanup:
void PerfDataDeallocCommandLineCache() void PerfDataDeallocCommandLineCache()
{ {
PCMD_LINE_CACHE cache = global_cache; PCMD_LINE_CACHE cache, pnext;
PCMD_LINE_CACHE cache_old;
while (cache && cache->pnext != NULL) for (cache = global_cache; cache; cache = pnext)
{ {
cache_old = cache; pnext = cache->pnext;
cache = cache->pnext; HeapFree(GetProcessHeap(), 0, cache);
HeapFree(GetProcessHeap(), 0, cache_old);
} }
global_cache = NULL;
} }
ULONG PerfDataGetSessionId(ULONG Index) ULONG PerfDataGetSessionId(ULONG Index)