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 ) ...@@ -816,14 +816,15 @@ LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
{ {
CHOOSECOLORW *ch32; CHOOSECOLORW *ch32;
CHOOSECOLOR16 *ch16 = (CHOOSECOLOR16 *) lParam; CHOOSECOLOR16 *ch16 = (CHOOSECOLOR16 *) lParam;
ch32 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHOOSECOLORW) ); if (ch16->lStructSize != sizeof(CHOOSECOLOR16) )
lpp->lpcc = ch32;
lpp->lpcc16 = ch16;
if (lpp->lpcc16->lStructSize != sizeof(CHOOSECOLOR16) )
{ {
HeapFree(GetProcessHeap(), 0, lpp);
EndDialog (hDlg, 0) ; EndDialog (hDlg, 0) ;
return FALSE; return FALSE;
} }
ch32 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHOOSECOLORW) );
lpp->lpcc = ch32;
lpp->lpcc16 = ch16;
ch32->lStructSize = sizeof(CHOOSECOLORW); ch32->lStructSize = sizeof(CHOOSECOLORW);
ch32->hwndOwner = HWND_32(ch16->hwndOwner); ch32->hwndOwner = HWND_32(ch16->hwndOwner);
/* Should be an HINSTANCE but MS made a typo */ /* Should be an HINSTANCE but MS made a typo */
...@@ -833,12 +834,14 @@ LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 ) ...@@ -833,12 +834,14 @@ LONG CC_WMInitDialog( HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL b16 )
ch32->Flags = ch16->Flags; ch32->Flags = ch16->Flags;
} }
else else
lpp->lpcc = (LPCHOOSECOLORW) lParam;
if (lpp->lpcc->lStructSize != sizeof(CHOOSECOLORW) )
{ {
EndDialog (hDlg, 0) ; lpp->lpcc = (LPCHOOSECOLORW) lParam;
return FALSE; if (lpp->lpcc->lStructSize != sizeof(CHOOSECOLORW) )
{
HeapFree(GetProcessHeap(), 0, lpp);
EndDialog (hDlg, 0) ;
return FALSE;
}
} }
SetWindowLongA(hDlg, DWL_USER, (LONG)lpp); SetWindowLongA(hDlg, DWL_USER, (LONG)lpp);
......
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