Author: pschweitzer
Date: Sat Dec 13 08:18:09 2014
New Revision: 65625
URL:
http://svn.reactos.org/svn/reactos?rev=65625&view=rev
Log:
[TASKMGR]
Don't leak process handle
CORE-3716
Modified:
trunk/reactos/base/applications/taskmgr/endproc.c
Modified: trunk/reactos/base/applications/taskmgr/endproc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/endproc.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/taskmgr/endproc.c [iso-8859-1] Sat Dec 13 08:18:09
2014
@@ -46,6 +46,7 @@
LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTitle, 256);
LoadStringW(hInst, IDS_MSG_CLOSESYSTEMPROCESS, strErrorText, 256);
MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONWARNING|MB_TOPMOST);
+ CloseHandle(hProcess);
return;
}
@@ -53,7 +54,10 @@
LoadStringW(hInst, IDS_MSG_WARNINGTERMINATING, strErrorText, 256);
LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTitle, 256);
if (MessageBoxW(hMainWnd, strErrorText, szTitle, MB_YESNO|MB_ICONWARNING|MB_TOPMOST)
!= IDYES)
+ {
+ if (hProcess) CloseHandle(hProcess);
return;
+ }
/* no such process or not enough privileges to open its token */
if (!hProcess)
@@ -82,7 +86,7 @@
/* return early if the process handle does not exist */
if (!hProcess)
- return FALSE;
+ return FALSE;
/* the important system processes that we don't want to let the user
kill come marked as critical, this simplifies the check greatly.
@@ -97,8 +101,8 @@
NULL);
if (NT_SUCCESS(status) && BreakOnTermination)
- return TRUE;
-
+ return TRUE;
+
return FALSE;
}
@@ -122,13 +126,17 @@
LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTitle, 256);
LoadStringW(hInst, IDS_MSG_CLOSESYSTEMPROCESS, strErrorText, 256);
MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONWARNING|MB_TOPMOST);
+ CloseHandle(hProcess);
return;
}
LoadStringW(hInst, IDS_MSG_WARNINGTERMINATING, strErrorText, 256);
LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTitle, 256);
if (MessageBoxW(hMainWnd, strErrorText, szTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
+ {
+ if (hProcess) CloseHandle(hProcess);
return;
+ }
if (!hProcess)
{