If g_pInterface is set to NULL outside the critical section in one thread while another thread is in the critical section, the channel client context allocated in the VirtualChannelEntry won't end up getting freed. The channel client context is normally loaded from g_pInterface in FreeRDP_VirtualChannelInit and stored in the pChannelInitData, then copied from there onto the pChannelOpenData structure in FreeRDP_VirtualChannelOpen and finally freed in freerdp_channels_free.
In case the file descriptor is -1 don't call close.
…error statuses to the server
…nlock when context is released.
…n so it will release all contexts to unblock calls waiting for transactions
When the event is reset in transport_check_fds xfreerdp doesn't work and consumes 100% CPU (see #2790). On windows this is require otherwise the CPU consumption is 100% there. This quick fix only resets the event on windows. It's a working approach but definitely not the final solution.