mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 21:45:41 +00:00
[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:
parent
3c35117f97
commit
70732b0ca4
1 changed files with 13 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue