comctl32: Fix error handling in PSM_ADDPAGE in case of memory

allocation failure.
This commit is contained in:
Thomas Weidenmueller 2005-12-31 13:12:19 +01:00 committed by Alexandre Julliard
parent d00fe021d3
commit 3faa66ee2a
1 changed files with 8 additions and 3 deletions

View File

@ -2288,6 +2288,7 @@ static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg,
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 @@ static BOOL PROPSHEET_AddPage(HWND hwndDlg,
/*
* 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;