[core,test] Fix TestConnect use after free
@@ -57,6 +57,8 @@ static int runInstance(int argc, char* argv[], freerdp** inst, DWORD timeout)
rc = 0;
finish:
freerdp_client_context_free(context);
+ if (inst)
+ *inst = NULL;
return rc;
}
@@ -137,6 +139,8 @@ static int testAbort(int port)
WaitForSingleObject(s_sync, INFINITE);
Sleep(100); /* Wait until freerdp_connect has been called */
+ if (instance)
+ {
freerdp_abort_connect_context(instance->context);
if (!freerdp_shall_disconnect_context(instance->context))
@@ -146,6 +150,7 @@ static int testAbort(int port)
s_sync = NULL;
return -1;
}
+ }
status = WaitForSingleObject(thread, 20000);
end = GetTickCount();
