[comctl32] Fix error handling in PSM_ADDPAGE

Thomas Weidenmueller wine-patches at reactsoft.com
Mon Dec 26 19:47:25 CST 2005


Fix the error handling in PSM_ADDPAGE in case of memory allocation failure.

- Thomas
-------------- next part --------------
Index: dlls/comctl32/propsheet.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/propsheet.c,v
retrieving revision 1.137
diff -u -r1.137 propsheet.c
--- dlls/comctl32/propsheet.c	8 Nov 2005 12:52:35 -0000	1.137
+++ dlls/comctl32/propsheet.c	27 Dec 2005 01:44:51 -0000
@@ -2288,6 +2288,7 @@
 static BOOL PROPSHEET_AddPage(HWND hwndDlg,
                               HPROPSHEETPAGE hpage)
 {
+  PropPageInfo * ppi;
   PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg,
                                                      PropSheetInfoStr);
   HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
@@ -2298,9 +2299,13 @@
   /*
    * Allocate and fill in a new PropPageInfo entry.
    */
-  psInfo->proppage = (PropPageInfo*) ReAlloc(psInfo->proppage,
-                                                      sizeof(PropPageInfo) *
-                                                      (psInfo->nPages + 1));
+  ppi = (PropPageInfo*) ReAlloc(psInfo->proppage,
+                                sizeof(PropPageInfo) *
+                                (psInfo->nPages + 1));
+  if (!ppi)
+      return FALSE;
+
+  psInfo->proppage = ppi;
   if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, psInfo->nPages))
       return FALSE;
 


More information about the wine-patches mailing list