Author: cwittich
Date: Sun Apr 12 16:09:26 2015
New Revision: 67176
URL:
http://svn.reactos.org/svn/reactos?rev=67176&view=rev
Log:
[TASKMGR]
fix some more memory leaks
CORE-9473
Modified:
trunk/reactos/base/applications/taskmgr/applpage.c
trunk/reactos/base/applications/taskmgr/perfdata.c
Modified: trunk/reactos/base/applications/taskmgr/applpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/applpage.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/applpage.c [iso-8859-1] Sun Apr 12 16:09:26
2015
@@ -89,6 +89,23 @@
return ColorDepth;
}
+void AppPageCleanup(void)
+{
+ int i;
+ LV_ITEM item;
+ LPAPPLICATION_PAGE_LIST_ITEM pData;
+ for (i = 0; i < ListView_GetItemCount(hApplicationPageListCtrl); i++)
+ {
+ memset(&item, 0, sizeof(LV_ITEM));
+ item.mask = LVIF_PARAM;
+ item.iItem = i;
+ (void)ListView_GetItem(hApplicationPageListCtrl, &item);
+ pData = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;
+ HeapFree(GetProcessHeap(), 0, pData);
+ }
+}
+
+
INT_PTR CALLBACK
ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
@@ -151,6 +168,7 @@
#ifdef RUN_APPS_PAGE
EndLocalThread(&hApplicationThread, dwApplicationThread);
#endif
+ AppPageCleanup();
break;
case WM_COMMAND:
Modified: trunk/reactos/base/applications/taskmgr/perfdata.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/perfdata.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/perfdata.c [iso-8859-1] Sun Apr 12 16:09:26
2015
@@ -330,12 +330,12 @@
}
/* Now alloc a new PERFDATA array and fill in the data */
+ pPerfData = (PPERFDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PERFDATA)
* ProcessCount);
if (pPerfDataOld) {
HeapFree(GetProcessHeap(), 0, pPerfDataOld);
}
pPerfDataOld = pPerfData;
- /* Clear out process perf data structures with HEAP_ZERO_MEMORY flag: */
- pPerfData = (PPERFDATA)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PERFDATA)
* ProcessCount);
+
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
for (Idx=0; Idx<ProcessCount; Idx++) {
/* Get the old perf data for this process (if any) */