libfreerdp-core: fix transport_free in cases where transport thread was not started

This commit is contained in:
Marc-André Moreau 2013-11-26 11:30:44 -05:00
parent 6d2608cbcb
commit f429b909a9

View File

@ -1062,8 +1062,17 @@ void transport_free(rdpTransport* transport)
{
if (transport->async)
{
assert(!transport->thread);
assert(!transport->stopEvent);
if (transport->stopEvent)
{
SetEvent(transport->stopEvent);
WaitForSingleObject(transport->thread, INFINITE);
CloseHandle(transport->thread);
CloseHandle(transport->stopEvent);
transport->thread = NULL;
transport->stopEvent = NULL;
}
}
if (transport->ReceiveBuffer)