Author: weiden
Date: Tue Oct 30 04:46:00 2007
New Revision: 29968
URL:
http://svn.reactos.org/svn/reactos?rev=29968&view=rev
Log:
Patch by Heis Spiter <heis_spiter(a)hotmail.com>om>:
- Fix a handle leak
See issue #2772 for more details.
Modified:
trunk/reactos/base/applications/taskmgr/graph.c
trunk/reactos/base/applications/taskmgr/taskmgr.c
Modified: trunk/reactos/base/applications/taskmgr/graph.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/graph.c (original)
+++ trunk/reactos/base/applications/taskmgr/graph.c Tue Oct 30 04:46:00 2007
@@ -137,7 +137,7 @@
RECT rcText;
COLORREF crPrevForeground;
TCHAR Text[260];
- HFONT hFont, hOldFont;
+ HFONT hOldFont;
ULONG CpuUsage;
ULONG CpuKernelUsage;
int nBars;
@@ -174,8 +174,7 @@
rcText = rcClient;
InflateRect(&rcText, -2, -2);
crPrevForeground = SetTextColor(hDC, RGB(0, 255, 0));
- hFont = GetStockObject(DEFAULT_GUI_FONT);
- hOldFont = SelectObject(hDC, hFont);
+ hOldFont = SelectObject(hDC, GetStockObject(DEFAULT_GUI_FONT));
DrawText(hDC, Text, -1, &rcText, DT_BOTTOM | DT_CENTER | DT_NOPREFIX |
DT_SINGLELINE);
SelectObject(hDC, hOldFont);
SetTextColor(hDC, crPrevForeground);
@@ -297,6 +296,8 @@
rcBarRight.bottom -=3;
}
+
+ SelectObject(hDC, hOldFont);
}
void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd)
@@ -403,6 +404,9 @@
rcBarRight.top += 3;
rcBarRight.bottom += 3;
}
+
+ SelectObject(hDC, hOldFont);
+ DeleteObject(hFont);
}
void Graph_DrawMemUsageHistoryGraph(HDC hDC, HWND hWnd)
Modified: trunk/reactos/base/applications/taskmgr/taskmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/taskmgr.c (original)
+++ trunk/reactos/base/applications/taskmgr/taskmgr.c Tue Oct 30 04:46:00 2007
@@ -74,6 +74,7 @@
/* Get the debug privilege for this process. */
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
+ CloseHandle(hToken);
}
/* Load our settings from the registry */