WinCE: Fix device reference leak which caused crash on libusb_exit().

The Windows CE device allocation code has always had a bug where it would
leak references to devices when they are allocated. This commit removes the
reference leak.

This leak was highlighted by the new hotplug code which now triggers a NULL
pointer dereference if not all devices are unreferenced before libusb_exit
is called.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
diff --git a/libusb/os/wince_usb.c b/libusb/os/wince_usb.c
index d8e8f55..76b559d 100644
--- a/libusb/os/wince_usb.c
+++ b/libusb/os/wince_usb.c
@@ -341,10 +341,10 @@
 	UKW_DEVICE devices[MAX_DEVICE_COUNT];
 	struct discovered_devs * new_devices = *discdevs;
 	DWORD count = 0, i;
-	struct libusb_device *dev;
+	struct libusb_device *dev = NULL;
 	unsigned char bus_addr, dev_addr;
 	unsigned long session_id;
-	BOOL success, need_unref = FALSE;
+	BOOL success;
 	DWORD release_list_offset = 0;
 	int r = LIBUSB_SUCCESS;
 
@@ -378,7 +378,6 @@
 				r = LIBUSB_ERROR_NO_MEM;
 				goto err_out;
 			}
-			need_unref = TRUE;
 			r = init_device(dev, devices[i], bus_addr, dev_addr);
 			if (r < 0)
 				goto err_out;
@@ -391,14 +390,13 @@
 			r = LIBUSB_ERROR_NO_MEM;
 			goto err_out;
 		}
-		need_unref = FALSE;
+		safe_unref_device(dev);
 	}
 	*discdevs = new_devices;
 	return r;
 err_out:
 	*discdevs = new_devices;
-	if (need_unref)
-		libusb_unref_device(dev);
+	safe_unref_device(dev);
 	// Release the remainder of the unprocessed device list.
 	// The devices added to new_devices already will still be passed up to libusb, 
 	// which can dispose of them at its leisure.
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 8184a6a..fde8fca 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 10756
+#define LIBUSB_NANO 10757