Fixes null dereference bug
Avoids a null function pointer dereference that happened, when
freerdp_urbdrc_client_subsystem_entry failed before invoking
udevman_load_interface.
@@ -313,6 +313,9 @@ static BOOL udevman_unregister_all_udevices(IUDEVMAN* idevman)
if (!idevman)
return FALSE;
+ if (!udevman->head)
+ return TRUE;
+
idevman->loading_lock(idevman);
idevman->rewind(idevman);
@@ -430,11 +433,17 @@ static void udevman_free(IUDEVMAN* idevman)
return;
udevman->running = FALSE;
+ if (udevman->thread)
+ {
WaitForSingleObject(udevman->thread, INFINITE);
+ CloseHandle(udevman->thread);
+ }
udevman_unregister_all_udevices(idevman);
+
+ if (udevman->devman_loading)
CloseHandle(udevman->devman_loading);
- CloseHandle(udevman->thread);
+
libusb_exit(udevman->context);
ArrayList_Free(udevman->hotplug_vid_pids);
