diff --git a/client/X11/cli/xfreerdp.c b/client/X11/cli/xfreerdp.c index a2911207e..0fa20b98b 100644 --- a/client/X11/cli/xfreerdp.c +++ b/client/X11/cli/xfreerdp.c @@ -41,6 +41,12 @@ int main(int argc, char* argv[]) freerdp_client_global_init(); xfi = freerdp_client_new(argc, argv); + + if (xfi == NULL) + { + return 1; + } + instance = xfi->instance; freerdp_client_start(xfi); diff --git a/client/X11/xf_interface.c b/client/X11/xf_interface.c index 3d27a5b49..7a84adc4f 100644 --- a/client/X11/xf_interface.c +++ b/client/X11/xf_interface.c @@ -1020,6 +1020,7 @@ void xf_window_free(xfInfo* xfi) } freerdp_clrconv_free(xfi->clrconv); + xfi->clrconv = NULL; if (xfi->hdc) gdi_DeleteDC(xfi->hdc); @@ -1186,7 +1187,6 @@ void* xf_thread(void* param) if (!status) { - freerdp_client_free(xfi); exit_code = XF_EXIT_CONN_FAILED; 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, instance->context->argv, settings); + if (status < 0) + { + freerdp_context_free(xfi->instance); + freerdp_free(xfi->instance); + free(xfi); + return NULL; + } if (settings->ConnectionFile) {