summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFORT David <rdp.effort@gmail.com>2016-04-26 23:34:05 +0200
committerBryce Harrington <bryce@osg.samsung.com>2016-05-19 16:19:08 -0700
commit2d4aa83fe194695aeaa76ddd2d00b9dcddc39433 (patch)
treef79e2981a4513c4d04d92a8dca2de60f541bb5e9
parent58b63ab7f1eec70c421b42a509f13dbc08a558ad (diff)
downloadweston-2d4aa83fe194695aeaa76ddd2d00b9dcddc39433.tar.gz
rdp: Fix the ContextNew callback with recent FreeRDP versions
Since a quite long time FreeRDP expect the ContextNew callback to return TRUE when it succeeds. Without this we have some arbitrary failures (most probably when eax is 0 at the end of the function). Signed-off-by: David Fort <contact@hardening-consulting.com>
-rw-r--r--src/compositor-rdp.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index f6778b61..4fc7c749 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -587,7 +587,7 @@ int rdp_implant_listener(struct rdp_backend *b, freerdp_listener* instance)
}
-static void
+static FREERDP_CB_RET_TYPE
rdp_peer_context_new(freerdp_peer* client, RdpPeerContext* context)
{
context->item.peer = client;
@@ -598,15 +598,32 @@ rdp_peer_context_new(freerdp_peer* client, RdpPeerContext* context)
#else
context->rfx_context = rfx_context_new(TRUE);
#endif
+ if (!context->rfx_context) {
+ FREERDP_CB_RETURN(FALSE);
+ }
+
context->rfx_context->mode = RLGR3;
context->rfx_context->width = client->settings->DesktopWidth;
context->rfx_context->height = client->settings->DesktopHeight;
rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8);
context->nsc_context = nsc_context_new();
+ if (!context->nsc_context)
+ goto out_error_nsc;
+
nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_B8G8R8A8);
context->encode_stream = Stream_New(NULL, 65536);
+ if (!context->encode_stream)
+ goto out_error_stream;
+
+ FREERDP_CB_RETURN(TRUE);
+
+out_error_nsc:
+ rfx_context_free(context->rfx_context);
+out_error_stream:
+ nsc_context_free(context->nsc_context);
+ FREERDP_CB_RETURN(FALSE);
}
static void