summaryrefslogtreecommitdiff
path: root/libusb
diff options
context:
space:
mode:
authorMichael Plante <michael.plante@gmail.com>2010-04-07 11:22:31 +0100
committerMichael Plante <michael.plante@gmail.com>2010-04-07 11:22:31 +0100
commitd102dd23992cadc056cf28a3aefb8cfbcf532e31 (patch)
tree7da4e8939afbce6074ad85d978d9a60f277517b9 /libusb
parentc73ee65a51084e0af9c2d94ce61a178902716f3a (diff)
downloadlibusb-d102dd23992cadc056cf28a3aefb8cfbcf532e31.tar.gz
more default context init fixesr245
Diffstat (limited to 'libusb')
-rw-r--r--libusb/core.c3
-rw-r--r--libusb/os/windows_usb.c2
2 files changed, 3 insertions, 2 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);
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
index 46d08a2..42b7133 100644
--- a/libusb/os/windows_usb.c
+++ b/libusb/os/windows_usb.c
@@ -4042,4 +4042,4 @@ static int composite_copy_transfer_data(struct usbi_transfer *itransfer, uint32_
struct windows_device_priv *priv = __device_priv(transfer->dev_handle->dev);
return priv->usb_interface[transfer_priv->interface_number].apib->copy_transfer_data(itransfer, io_size);
-} \ No newline at end of file
+}