[coverity] 1543218 Resource leak

This commit is contained in:
akallabeth 2024-04-11 11:23:30 +02:00 committed by akallabeth
parent fbc5dfffac
commit 1197384315

View File

@ -190,6 +190,7 @@ static BOOL pf_server_get_target_info(rdpContext* context, rdpSettings* settings
static BOOL pf_server_setup_channels(freerdp_peer* peer) static BOOL pf_server_setup_channels(freerdp_peer* peer)
{ {
BOOL rc = FALSE;
char** accepted_channels = NULL; char** accepted_channels = NULL;
size_t accepted_channels_count = 0; size_t accepted_channels_count = 0;
pServerContext* ps = (pServerContext*)peer->context; pServerContext* ps = (pServerContext*)peer->context;
@ -209,7 +210,7 @@ static BOOL pf_server_setup_channels(freerdp_peer* peer)
if (!channelContext) if (!channelContext)
{ {
PROXY_LOG_ERR(TAG, ps, "error seting up channelContext for '%s'", cname); PROXY_LOG_ERR(TAG, ps, "error seting up channelContext for '%s'", cname);
return FALSE; goto fail;
} }
if (strcmp(cname, DRDYNVC_SVC_CHANNEL_NAME) == 0) 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"); PROXY_LOG_ERR(TAG, ps, "error while setting up dynamic channel");
StaticChannelContext_free(channelContext); StaticChannelContext_free(channelContext);
return FALSE; goto fail;
} }
} }
else if (strcmp(cname, RDPDR_SVC_CHANNEL_NAME) == 0 && 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"); PROXY_LOG_ERR(TAG, ps, "error while setting up redirection channel");
StaticChannelContext_free(channelContext); StaticChannelContext_free(channelContext);
return FALSE; goto fail;
} }
} }
else 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"); PROXY_LOG_ERR(TAG, ps, "error while setting up generic channel");
StaticChannelContext_free(channelContext); StaticChannelContext_free(channelContext);
return FALSE; goto fail;
} }
} }
@ -246,12 +247,14 @@ static BOOL pf_server_setup_channels(freerdp_peer* peer)
{ {
StaticChannelContext_free(channelContext); StaticChannelContext_free(channelContext);
PROXY_LOG_ERR(TAG, ps, "error inserting channelContext in byId table for '%s'", cname); PROXY_LOG_ERR(TAG, ps, "error inserting channelContext in byId table for '%s'", cname);
return FALSE; goto fail;
} }
} }
rc = TRUE;
fail:
free(accepted_channels); free(accepted_channels);
return TRUE; return rc;
} }
/* Event callbacks */ /* Event callbacks */