From 56a1425bcadc5f4a7f7fffae6d7af8b9ec243001 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 17 Jan 2017 16:00:51 +0100 Subject: [PATCH] Do not terminate channel disconnect if one fails. --- libfreerdp/core/client.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/libfreerdp/core/client.c b/libfreerdp/core/client.c index b10d064fb..22866ffa3 100644 --- a/libfreerdp/core/client.c +++ b/libfreerdp/core/client.c @@ -34,7 +34,8 @@ static WINPR_TLS void* g_pInterface = NULL; static WINPR_TLS rdpChannels* g_channels = NULL; /* use only for VirtualChannelInit hack */ -static volatile LONG g_OpenHandleSeq = 1; /* use global counter to ensure uniqueness across channel manager instances */ +static volatile LONG g_OpenHandleSeq = + 1; /* use global counter to ensure uniqueness across channel manager instances */ static WINPR_TLS rdpChannelHandles g_ChannelHandles = { NULL, NULL }; static CHANNEL_OPEN_DATA* freerdp_channels_find_channel_open_data_by_name( @@ -624,6 +625,7 @@ UINT freerdp_channels_disconnect(rdpChannels* channels, freerdp* instance) /* tell all libraries we are shutting down */ for (index = 0; index < channels->clientDataCount; index++) { + char* name[9]; ChannelDisconnectedEventArgs e; pChannelClientData = &channels->clientDataList[index]; @@ -639,24 +641,17 @@ UINT freerdp_channels_disconnect(rdpChannels* channels, freerdp* instance) } if (getChannelError(instance->context) != CHANNEL_RC_OK) - goto fail; + continue; pChannelOpenData = &channels->openDataList[index]; - name = (char*) malloc(9); - - if (!name) - return -1; - CopyMemory(name, pChannelOpenData->name, 8); name[8] = '\0'; EventArgsInit(&e, "freerdp"); e.name = name; e.pInterface = pChannelOpenData->pInterface; PubSub_OnChannelDisconnected(instance->context->pubSub, instance->context, &e); - free(name); } -fail: return error; } @@ -837,7 +832,8 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle, pChannelOpenData = &channels->openDataList[channels->openDataCount]; pChannelOpenData->OpenHandle = InterlockedIncrement(&g_OpenHandleSeq); pChannelOpenData->channels = channels; - freerdp_channel_add_open_handle_data(&g_ChannelHandles, pChannelOpenData->OpenHandle, (void*) channels); + freerdp_channel_add_open_handle_data(&g_ChannelHandles, pChannelOpenData->OpenHandle, + (void*) channels); HashTable_Add(channels->openHandles, (void*)(UINT_PTR) pChannelOpenData->OpenHandle, (void*) pChannelOpenData); pChannelOpenData->flags = 1; /* init */