From 1197384315d66b82bdbecb177d5d04f6632df6a3 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Thu, 11 Apr 2024 11:23:30 +0200 Subject: [PATCH] [coverity] 1543218 Resource leak --- server/proxy/pf_server.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/server/proxy/pf_server.c b/server/proxy/pf_server.c index 545ab93a6..5a4828b2a 100644 --- a/server/proxy/pf_server.c +++ b/server/proxy/pf_server.c @@ -190,6 +190,7 @@ static BOOL pf_server_get_target_info(rdpContext* context, rdpSettings* settings static BOOL pf_server_setup_channels(freerdp_peer* peer) { + BOOL rc = FALSE; char** accepted_channels = NULL; size_t accepted_channels_count = 0; pServerContext* ps = (pServerContext*)peer->context; @@ -209,7 +210,7 @@ static BOOL pf_server_setup_channels(freerdp_peer* peer) if (!channelContext) { PROXY_LOG_ERR(TAG, ps, "error seting up channelContext for '%s'", cname); - return FALSE; + goto fail; } if (strcmp(cname, DRDYNVC_SVC_CHANNEL_NAME) == 0) @@ -218,7 +219,7 @@ static BOOL pf_server_setup_channels(freerdp_peer* peer) { PROXY_LOG_ERR(TAG, ps, "error while setting up dynamic channel"); StaticChannelContext_free(channelContext); - return FALSE; + goto fail; } } else if (strcmp(cname, RDPDR_SVC_CHANNEL_NAME) == 0 && @@ -228,7 +229,7 @@ static BOOL pf_server_setup_channels(freerdp_peer* peer) { PROXY_LOG_ERR(TAG, ps, "error while setting up redirection channel"); StaticChannelContext_free(channelContext); - return FALSE; + goto fail; } } else @@ -237,7 +238,7 @@ static BOOL pf_server_setup_channels(freerdp_peer* peer) { PROXY_LOG_ERR(TAG, ps, "error while setting up generic channel"); StaticChannelContext_free(channelContext); - return FALSE; + goto fail; } } @@ -246,12 +247,14 @@ static BOOL pf_server_setup_channels(freerdp_peer* peer) { StaticChannelContext_free(channelContext); PROXY_LOG_ERR(TAG, ps, "error inserting channelContext in byId table for '%s'", cname); - return FALSE; + goto fail; } } + rc = TRUE; +fail: free(accepted_channels); - return TRUE; + return rc; } /* Event callbacks */