From c1bf7fbab0ed2b5606ff0d50cde2896d0ac2f4ff Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 26 Jun 2013 16:41:22 +0200 Subject: WinCE: ref result of usbi_get_device_by_session_id() After the "WinCE: Fix device reference leak which caused crash on libusb_exit()" commit, the code always unref-s dev after adding it to discovered_devs. But if dev comes from usbi_get_device_by_session_id() it is a weak ref and as such should not be unreffed. Instead of re-adding comlicate ref tracking logic, this patch fixes this with a libusb_device_ref(dev) of dev comes from usbi_get_device_by_session_id(), turning the weak ref into a strong ref. Signed-off-by: Hans de Goede --- libusb/os/wince_usb.c | 1 + libusb/version_nano.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libusb/os/wince_usb.c b/libusb/os/wince_usb.c index 76b559d..e4a6633 100644 --- a/libusb/os/wince_usb.c +++ b/libusb/os/wince_usb.c @@ -366,6 +366,7 @@ static int wince_get_device_list( if (dev) { usbi_dbg("using existing device for %d/%d (session %ld)", bus_addr, dev_addr, session_id); + libusb_ref_device(dev); // Release just this element in the device list (as we already hold a // reference to it). UkwReleaseDeviceList(driver_handle, &devices[i], 1); diff --git a/libusb/version_nano.h b/libusb/version_nano.h index fde8fca..48c7a87 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10757 +#define LIBUSB_NANO 10758 -- cgit v1.2.1