appwiz.cpl: fix handle leak

Pierre Schweitzer pierre at reactos.org
Fri Dec 30 15:03:51 CST 2011


-------------- next part --------------
>From 0f38520f7be425e95d572ef0445e32aa88e531de Mon Sep 17 00:00:00 2001
From: Pierre Schweitzer <pierre at reactos.org>
Date: Fri, 30 Dec 2011 21:53:54 +0100
Subject: appwiz.cpl: Fix handle leak.

---
 dlls/appwiz.cpl/addons.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/dlls/appwiz.cpl/addons.c b/dlls/appwiz.cpl/addons.c
index 9a410b8..64c3e9c 100644
--- a/dlls/appwiz.cpl/addons.c
+++ b/dlls/appwiz.cpl/addons.c
@@ -473,6 +473,8 @@ static void run_winebrowser(const WCHAR *url)
 
 static INT_PTR CALLBACK installer_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
+    HANDLE hThread;
+
     switch(msg) {
     case WM_INITDIALOG:
         ShowWindow(GetDlgItem(hwnd, ID_DWL_PROGRESS), SW_HIDE);
@@ -500,7 +502,9 @@ static INT_PTR CALLBACK installer_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
             ShowWindow(GetDlgItem(hwnd, ID_DWL_PROGRESS), SW_SHOW);
             EnableWindow(GetDlgItem(hwnd, ID_DWL_INSTALL), 0);
             EnableWindow(GetDlgItem(hwnd, IDCANCEL), 0); /* FIXME */
-            CreateThread(NULL, 0, download_proc, NULL, 0, NULL);
+            hThread = CreateThread(NULL, 0, download_proc, NULL, 0, NULL);
+            if (hThread)
+                CloseHandle(hThread);
             return FALSE;
         }
     }
-- 
1.7.4.1



More information about the wine-patches mailing list