Merge pull request #1193 from zeha/fix-xfreerdp-crashes

xfreerdp: fix xfi lifecycle and other crashers
This commit is contained in:
Martin Fleisz 2013-04-18 03:14:27 -07:00
commit 50c94186e8
2 changed files with 14 additions and 1 deletions

View File

@ -41,6 +41,12 @@ int main(int argc, char* argv[])
freerdp_client_global_init(); freerdp_client_global_init();
xfi = freerdp_client_new(argc, argv); xfi = freerdp_client_new(argc, argv);
if (xfi == NULL)
{
return 1;
}
instance = xfi->instance; instance = xfi->instance;
freerdp_client_start(xfi); freerdp_client_start(xfi);

View File

@ -1020,6 +1020,7 @@ void xf_window_free(xfInfo* xfi)
} }
freerdp_clrconv_free(xfi->clrconv); freerdp_clrconv_free(xfi->clrconv);
xfi->clrconv = NULL;
if (xfi->hdc) if (xfi->hdc)
gdi_DeleteDC(xfi->hdc); gdi_DeleteDC(xfi->hdc);
@ -1186,7 +1187,6 @@ void* xf_thread(void* param)
if (!status) if (!status)
{ {
freerdp_client_free(xfi);
exit_code = XF_EXIT_CONN_FAILED; exit_code = XF_EXIT_CONN_FAILED;
ExitThread(exit_code); ExitThread(exit_code);
} }
@ -1489,6 +1489,13 @@ xfInfo* freerdp_client_new(int argc, char** argv)
status = freerdp_client_parse_command_line_arguments(instance->context->argc, status = freerdp_client_parse_command_line_arguments(instance->context->argc,
instance->context->argv, settings); instance->context->argv, settings);
if (status < 0)
{
freerdp_context_free(xfi->instance);
freerdp_free(xfi->instance);
free(xfi);
return NULL;
}
if (settings->ConnectionFile) if (settings->ConnectionFile)
{ {