diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-06-27 09:33:28 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-06-27 09:33:28 +0200 |
commit | e2c54d93b1fd89517b75e6761fad72f7c35532ad (patch) | |
tree | 3e4c3e7582ba0edc892a039cad17825b02c8f744 | |
parent | 004c7a7fabb1c1f1ded97c776291c4a645941d99 (diff) | |
download | libusb-e2c54d93b1fd89517b75e6761fad72f7c35532ad.tar.gz |
core: Always warn when there are leaked device refs on exit
This check should done with hotplug capable backends too.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | libusb/core.c | 9 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/libusb/core.c b/libusb/core.c index 7fa3b63..bc44415 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -1923,11 +1923,12 @@ void API_EXPORTED libusb_exit(struct libusb_context *ctx) libusb_unref_device(dev); } usbi_mutex_unlock(&ctx->usb_devs_lock); - } else if (!list_empty(&ctx->usb_devs)) - usbi_warn(ctx, "some libusb_devices were leaked"); + } - /* a little sanity check. doesn't bother with open_devs locking because - * unless there is an application bug, nobody will be accessing this. */ + /* a few sanity checks. don't bother with locking because unless + * there is an application bug, nobody will be accessing these. */ + if (!list_empty(&ctx->usb_devs)) + usbi_warn(ctx, "some libusb_devices were leaked"); if (!list_empty(&ctx->open_devs)) usbi_warn(ctx, "application left some devices open"); diff --git a/libusb/version_nano.h b/libusb/version_nano.h index a43bb74..4c8a68d 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10762 +#define LIBUSB_NANO 10763 |