Fix handle leaks in encomsp and remdesk server

Ensure proper thread cleanup when these channel servers are stopped.
This commit is contained in:
Adrian A 2017-05-11 13:21:47 -07:00
parent 1e3d4d62a4
commit 5beb181dec
2 changed files with 8 additions and 0 deletions

View File

@ -338,6 +338,7 @@ static UINT encomsp_server_stop(EncomspServerContext* context)
}
CloseHandle(context->priv->Thread);
CloseHandle(context->priv->StopEvent);
return error;
}
@ -368,6 +369,9 @@ void encomsp_server_context_free(EncomspServerContext* context)
{
if (context)
{
if (context->priv->ChannelHandle != INVALID_HANDLE_VALUE)
WTSVirtualChannelClose(context->priv->ChannelHandle);
free(context->priv);
free(context);
}

View File

@ -756,6 +756,7 @@ static UINT remdesk_server_stop(RemdeskServerContext* context)
}
CloseHandle(context->priv->Thread);
CloseHandle(context->priv->StopEvent);
return CHANNEL_RC_OK;
}
@ -787,6 +788,9 @@ void remdesk_server_context_free(RemdeskServerContext* context)
{
if (context)
{
if (context->priv->ChannelHandle != INVALID_HANDLE_VALUE)
WTSVirtualChannelClose(context->priv->ChannelHandle);
free(context->priv);
free(context);
}