[TASKMGR] Work around memory leak in performance tab of taskmgr (#8017)

* [TASKMGR] Work around Taskmgr memory leak by changing heap allocation methodology.
CORE-18014
This commit is contained in:
Doug Lyons 2025-06-10 18:04:11 -05:00 committed by GitHub
parent 3c35117f97
commit 70732b0ca4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -64,7 +64,14 @@ BOOL PerfDataInitialize(void)
* Create the SYSTEM Sid
*/
AllocateAndInitializeSid(&NtSidAuthority, 1, SECURITY_LOCAL_SYSTEM_RID, 0, 0, 0, 0, 0, 0, 0, &SystemUserSid);
return TRUE;
/*
* Set up global info storage
*/
SystemProcessorTimeInfo = (PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)HeapAlloc(GetProcessHeap(),
0, sizeof(*SystemProcessorTimeInfo) * SystemBasicInfo.NumberOfProcessors);
return SystemProcessorTimeInfo != NULL;
}
void PerfDataUninitialize(void)
@ -247,10 +254,12 @@ void PerfDataRefresh(void)
/*
* Save system processor time info
*/
if (SystemProcessorTimeInfo) {
HeapFree(GetProcessHeap(), 0, SystemProcessorTimeInfo);
memcpy(SystemProcessorTimeInfo, SysProcessorTimeInfo,
sizeof(*SystemProcessorTimeInfo) * SystemBasicInfo.NumberOfProcessors);
if (SysProcessorTimeInfo) {
HeapFree(GetProcessHeap(), 0, SysProcessorTimeInfo);
}
SystemProcessorTimeInfo = SysProcessorTimeInfo;
/*
* Save system handle info