core: Unlock and clear default ctx in all error paths in libusb_init
Commit 32a22069428cda9d63aa666e92fb8882a83d4515 reordered and
refactored libusb_init. This resulted in moving code outside the
default ctx lock that was unrelated to it. But this resulted in
broken error path cleanup logic that leaves the default ctx as
locked, half initialized and freed in case a libusb_set_option or
the usbi_io_init call fails.
Undo part of the previous reordering to unlock and clear the default
ctx in all error paths in libusb_init.
Signed-off-by: Nathan Hjelm <email@example.com>
2 files changed