From 9a6c85f68aa0e2ec4595d4673e59f5ade2521a6f Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Thu, 15 Jun 2023 15:36:19 +0900 Subject: [PATCH] [TASKMGR] Fix PerfDataDeallocCommandLineCache Do not leak memory. CORE-18014 --- base/applications/taskmgr/perfdata.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/base/applications/taskmgr/perfdata.c b/base/applications/taskmgr/perfdata.c index 7eb1d90fd5d..166f7a7ff07 100644 --- a/base/applications/taskmgr/perfdata.c +++ b/base/applications/taskmgr/perfdata.c @@ -649,16 +649,15 @@ cleanup: void PerfDataDeallocCommandLineCache() { - PCMD_LINE_CACHE cache = global_cache; - PCMD_LINE_CACHE cache_old; + PCMD_LINE_CACHE cache, pnext; - while (cache && cache->pnext != NULL) + for (cache = global_cache; cache; cache = pnext) { - cache_old = cache; - cache = cache->pnext; - - HeapFree(GetProcessHeap(), 0, cache_old); + pnext = cache->pnext; + HeapFree(GetProcessHeap(), 0, cache); } + + global_cache = NULL; } ULONG PerfDataGetSessionId(ULONG Index)