Module: wine Branch: refs/heads/master Commit: 3faa66ee2ab5274c2cb38e3364f4869e8928f8ff URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=3faa66ee2ab5274c2cb38e33...
Author: Thomas Weidenmueller wine-patches@reactsoft.com Date: Sat Dec 31 13:12:19 2005 +0100
comctl32: Fix error handling in PSM_ADDPAGE in case of memory allocation failure.
---
dlls/comctl32/propsheet.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 08c55b8..78fdc43 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -2288,6 +2288,7 @@ static LRESULT PROPSHEET_QuerySiblings(H 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 hwndD /* * 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;