summaryrefslogtreecommitdiff
path: root/libusb/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'libusb/core.c')
-rw-r--r--libusb/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libusb/core.c b/libusb/core.c
index a66cd58..a0880d9 100644
--- a/libusb/core.c
+++ b/libusb/core.c
@@ -1534,7 +1534,8 @@ API_EXPORTED int libusb_init(libusb_context **context)
return 0;
err:
- usbi_default_context = NULL;
+ if (usbi_default_context == ctx)
+ usbi_default_context = NULL;
usbi_mutex_static_unlock(&default_context_lock);
usbi_mutex_destroy(&ctx->open_devs_lock);
usbi_mutex_destroy(&ctx->usb_devs_lock);