taskmgr: fix handle leaks
Pierre Schweitzer
pierre at reactos.org
Fri Dec 30 15:04:30 CST 2011
-------------- next part --------------
>From 1bf2793d1e03eb9b02f6a03f63fdc23609f50d5c Mon Sep 17 00:00:00 2001
From: Pierre Schweitzer <pierre at reactos.org>
Date: Fri, 30 Dec 2011 21:56:00 +0100
Subject: taskmgr: Fix handle leaks.
---
programs/taskmgr/applpage.c | 5 ++++-
programs/taskmgr/perfpage.c | 7 ++++++-
programs/taskmgr/procpage.c | 5 ++++-
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/programs/taskmgr/applpage.c b/programs/taskmgr/applpage.c
index 3a51dd8..6de1653 100644
--- a/programs/taskmgr/applpage.c
+++ b/programs/taskmgr/applpage.c
@@ -847,6 +847,7 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
int nYDifference;
int cx, cy;
LVCOLUMNW column;
+ HANDLE hThread;
WCHAR wszTask[255];
WCHAR wszStatus[255];
@@ -891,7 +892,9 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
UpdateApplicationListControlViewSetting();
/* Start our refresh thread */
- CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0, NULL);
+ hThread = CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0, NULL);
+ if (hThread)
+ CloseHandle(hThread);
return TRUE;
diff --git a/programs/taskmgr/perfpage.c b/programs/taskmgr/perfpage.c
index 5b1fd41..0fd0198 100644
--- a/programs/taskmgr/perfpage.c
+++ b/programs/taskmgr/perfpage.c
@@ -273,6 +273,9 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
RECT rc;
int nXDifference;
int nYDifference;
+#ifdef RUN_PERF_PAGE
+ HANDLE hThread;
+#endif
/* HDC hdc; */
/* PAINTSTRUCT ps; */
@@ -343,7 +346,9 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
GraphCtrl_SetPlotColor(&PerformancePageMemUsageHistoryGraph, 0, RGB(255, 255, 0)) ;
/* Start our refresh thread */
#ifdef RUN_PERF_PAGE
- CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL);
+ hThread = CreateThread(NULL, 0, PerformancePageRefreshThread, NULL, 0, NULL);
+ if (hThread)
+ CloseHandle(hThread);
#endif
/*
diff --git a/programs/taskmgr/procpage.c b/programs/taskmgr/procpage.c
index 7941d5c..e81bb4f 100644
--- a/programs/taskmgr/procpage.c
+++ b/programs/taskmgr/procpage.c
@@ -448,6 +448,7 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
int nYDifference;
int cx, cy;
DWORD extended_styles;
+ HANDLE hThread;
switch (message) {
case WM_INITDIALOG:
@@ -483,7 +484,9 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
OldProcessListWndProc = (WNDPROC)SetWindowLongPtrW(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);
/* Start our refresh thread */
- CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL);
+ hThread = CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL);
+ if (hThread)
+ CloseHandle(hThread);
return TRUE;
--
1.7.4.1
More information about the wine-patches
mailing list