https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9a6c85f68aa0e2ec4595d…
commit 9a6c85f68aa0e2ec4595d4673e59f5ade2521a6f
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Jun 15 15:36:19 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Thu Jun 15 15:36:19 2023 +0900
[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)