From db66a64aabdb34169fbbe244ab44dcc0da90f65a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Molinari?= Date: Mon, 22 Jul 2024 16:01:58 +0200 Subject: [PATCH] rdp: Fix invalid free and memory leak on error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Peer context creation's error handling labels must be swapped to avoid an invalid free when nsc context creation fails and a leak of the rfx context when encode stream creation fails. Signed-off-by: Loïc Molinari --- libweston/backend-rdp/rdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libweston/backend-rdp/rdp.c b/libweston/backend-rdp/rdp.c index fc05f112d..8c99549ad 100644 --- a/libweston/backend-rdp/rdp.c +++ b/libweston/backend-rdp/rdp.c @@ -765,10 +765,10 @@ rdp_peer_context_new(freerdp_peer* client, RdpPeerContext* context) return TRUE; -out_error_nsc: - rfx_context_free(context->rfx_context); out_error_stream: nsc_context_free(context->nsc_context); +out_error_nsc: + rfx_context_free(context->rfx_context); return FALSE; }