Marcus Meissner : cryptui: Check NULL ptr differently (Coverity).

Alexandre Julliard julliard at winehq.org
Thu Feb 5 09:21:11 CST 2009


Module: wine
Branch: master
Commit: 540f11f6d6bf75247d8b9e1cfd8477e33768d9a7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=540f11f6d6bf75247d8b9e1cfd8477e33768d9a7

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Wed Feb  4 23:02:43 2009 +0100

cryptui: Check NULL ptr differently (Coverity).

---

 dlls/cryptui/main.c |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c
index 498c158..8590d0c 100644
--- a/dlls/cryptui/main.c
+++ b/dlls/cryptui/main.c
@@ -1076,25 +1076,24 @@ static LRESULT CALLBACK cert_mgr_dlg_proc(HWND hwnd, UINT msg, WPARAM wp,
         HWND tab = GetDlgItem(hwnd, IDC_MGR_STORES);
 
         data = HeapAlloc(GetProcessHeap(), 0, sizeof(struct CertMgrData));
-        if (data)
+        if (!data)
+            return 0;
+        data->imageList = ImageList_Create(16, 16, ILC_COLOR4 | ILC_MASK, 2, 0);
+        if (data->imageList)
         {
-            data->imageList = ImageList_Create(16, 16, ILC_COLOR4 | ILC_MASK,
-             2, 0);
-            if (data->imageList)
-            {
-                HBITMAP bmp;
-                COLORREF backColor = RGB(255, 0, 255);
+            HBITMAP bmp;
+            COLORREF backColor = RGB(255, 0, 255);
 
-                bmp = LoadBitmapW(hInstance, MAKEINTRESOURCEW(IDB_SMALL_ICONS));
-                ImageList_AddMasked(data->imageList, bmp, backColor);
-                DeleteObject(bmp);
-                ImageList_SetBkColor(data->imageList, CLR_NONE);
-                SendMessageW(GetDlgItem(hwnd, IDC_MGR_CERTS), LVM_SETIMAGELIST,
-                 LVSIL_SMALL, (LPARAM)data->imageList);
-            }
-            SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data);
-            data->title = pCryptUICertMgr->pwszTitle;
+            bmp = LoadBitmapW(hInstance, MAKEINTRESOURCEW(IDB_SMALL_ICONS));
+            ImageList_AddMasked(data->imageList, bmp, backColor);
+            DeleteObject(bmp);
+            ImageList_SetBkColor(data->imageList, CLR_NONE);
+            SendMessageW(GetDlgItem(hwnd, IDC_MGR_CERTS), LVM_SETIMAGELIST,
+                         LVSIL_SMALL, (LPARAM)data->imageList);
         }
+        SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data);
+        data->title = pCryptUICertMgr->pwszTitle;
+
         initialize_purpose_selection(hwnd);
         add_cert_columns(hwnd);
         if (pCryptUICertMgr->pwszTitle)




More information about the wine-cvs mailing list