[PATCH 3/6] rdp: Fix the ContextNew callback with recent FreeRDP versions

Bryce Harrington bryce at osg.samsung.com
Thu May 19 23:25:31 UTC 2016


On Tue, Apr 26, 2016 at 11:34:05PM +0200, David Fort wrote:
> 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 at hardening-consulting.com>

LGTM, it returns BOOL for newer versions, ref.
  https://github.com/FreeRDP/FreeRDP/blob/master/include/freerdp/peer.h
and FREERDP_CB_RET_TYPE is abstracting the change so it supports new and
old versions, so:

Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>

and pushed:
   58b63ab..2d4aa83  master -> master


> ---
>  src/compositor-rdp.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
> index 862eedc..3e7699c 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
> -- 
> 1.9.1
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list