winefile: Don't use child after it has been freed.

If winefile is unable to create a window, it frees the child pointer.
However, it then proceeds to use the child pointer.
This commit is contained in:
Paul TBBle Hampson 2009-02-03 09:39:32 +11:00 committed by Alexandre Julliard
parent aacbe97ae5
commit c09f1357bc
1 changed files with 12 additions and 5 deletions

View File

@ -4706,7 +4706,7 @@ static void InitInstance(HINSTANCE hinstance)
}
static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
static BOOL show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
{
static const TCHAR sMDICLIENT[] = {'M','D','I','C','L','I','E','N','T','\0'};
@ -4718,7 +4718,7 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
CLIENTCREATESTRUCT ccs;
if (Globals.hMainWnd)
return;
return TRUE;
opts = load_registry_settings();
hMenuFrame = LoadMenu(Globals.hInstance, MAKEINTRESOURCE(IDM_WINEFILE));
@ -4796,8 +4796,10 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
child->pos.rcNormalPosition.right = 320;
child->pos.rcNormalPosition.bottom = 280;
if (!create_child_window(child))
if (!create_child_window(child)) {
HeapFree(GetProcessHeap(), 0, child);
return FALSE;
}
SetWindowPlacement(child->hwnd, &child->pos);
@ -4807,7 +4809,7 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
UpdateWindow(Globals.hMainWnd);
if (path && path[0])
if (child->hwnd && path && path[0])
{
int index,count;
TCHAR drv[_MAX_DRIVE+1], dir[_MAX_DIR], name[_MAX_FNAME], ext[_MAX_EXT];
@ -4835,6 +4837,7 @@ static void show_frame(HWND hwndParent, int cmdshow, LPCTSTR path)
}
}
}
return TRUE;
}
static void ExitInstance(void)
@ -4888,7 +4891,11 @@ static int winefile_main(HINSTANCE hinstance, int cmdshow, LPCTSTR path)
InitInstance(hinstance);
show_frame(0, cmdshow, path);
if( !show_frame(0, cmdshow, path) )
{
ExitInstance();
return 1;
}
while(GetMessage(&msg, 0, 0, 0)) {
if (Globals.hmdiclient && TranslateMDISysAccel(Globals.hmdiclient, &msg))