[PATCH] [RDP compositor] don't crash when the key file doesn't exist

David FORT rdp.effort at gmail.com
Sat Aug 1 15:35:30 PDT 2015


This allows to close the remaining issue in
https://bugs.freedesktop.org/show_bug.cgi?id=91390
---
 src/compositor-rdp.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index 4ef0dd1..c76af61 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -1102,7 +1102,10 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b)
 	}
 	settings->NlaSecurity = FALSE;
 
-	client->Initialize(client);
+	if (!client->Initialize(client)) {
+		weston_log("peer initialization failed\n");
+		goto error_initialize;
+	}
 
 	settings->OsMajorType = OSMAJORTYPE_UNIX;
 	settings->OsMinorType = OSMINORTYPE_PSEUDO_XSERVER;
@@ -1113,7 +1116,6 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b)
 	settings->FrameMarkerCommandEnabled = TRUE;
 	settings->SurfaceFrameMarkerEnabled = TRUE;
 
-
 	client->Capabilities = xf_peer_capabilities;
 	client->PostConnect = xf_peer_post_connect;
 	client->Activate = xf_peer_activate;
@@ -1129,7 +1131,7 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b)
 
 	if (!client->GetFileDescriptor(client, rfds, &rcount)) {
 		weston_log("unable to retrieve client fds\n");
-		return -1;
+		goto error_initialize;
 	}
 
 	loop = wl_display_get_event_loop(b->compositor->wl_display);
@@ -1144,6 +1146,10 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b)
 
 	wl_list_insert(&b->output->peers, &peerCtx->item.link);
 	return 0;
+
+error_initialize:
+	client->Close(client);
+	return -1;
 }
 
 
@@ -1152,7 +1158,7 @@ rdp_incoming_peer(freerdp_listener *instance, freerdp_peer *client)
 {
 	struct rdp_backend *b = (struct rdp_backend *)instance->param4;
 	if (rdp_peer_init(client, b) < 0) {
-		weston_log("error when treating incoming peer");
+		weston_log("error when treating incoming peer\n");
 		FREERDP_CB_RETURN(FALSE);
 	}
 
-- 
1.9.1



More information about the wayland-devel mailing list