Commit 4ba3b0aa authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

Fix memory leaks on error path.

parent abbcf413
......@@ -816,14 +816,15 @@ LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
{
CHOOSECOLORW *ch32;
CHOOSECOLOR16 *ch16 = (CHOOSECOLOR16 *) lParam;
ch32 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHOOSECOLORW) );
lpp->lpcc = ch32;
lpp->lpcc16 = ch16;
if (lpp->lpcc16->lStructSize != sizeof(CHOOSECOLOR16) )
if (ch16->lStructSize != sizeof(CHOOSECOLOR16) )
{
HeapFree(GetProcessHeap(), 0, lpp);
EndDialog (hDlg, 0) ;
return FALSE;
}
ch32 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHOOSECOLORW) );
lpp->lpcc = ch32;
lpp->lpcc16 = ch16;
ch32->lStructSize = sizeof(CHOOSECOLORW);
ch32->hwndOwner = HWND_32(ch16->hwndOwner);
/* Should be an HINSTANCE but MS made a typo */
......@@ -833,13 +834,15 @@ LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
ch32->Flags = ch16->Flags;
}
else
{
lpp->lpcc = (LPCHOOSECOLORW) lParam;
if (lpp->lpcc->lStructSize != sizeof(CHOOSECOLORW) )
{
HeapFree(GetProcessHeap(), 0, lpp);
EndDialog (hDlg, 0) ;
return FALSE;
}
}
SetWindowLongA(hDlg, DWL_USER, (LONG)lpp);
if (!(lpp->lpcc->Flags & CC_SHOWHELP))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment