summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-06-17 08:39:21 +0200
committerHans de Goede <hdegoede@redhat.com>2013-06-17 08:39:21 +0200
commitd8c714207df93d2f0d121520c5f2f81efc1f9431 (patch)
treed2981c7beca82f85bcfc8801f4d7e2f6de74b910
parent1cf2969bc8e696118bb639c787d68fc324690f88 (diff)
downloadlibusb-d8c714207df93d2f0d121520c5f2f81efc1f9431.tar.gz
linux_udev: Don't free the udev_monitor while the event thread may still use it
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--libusb/os/linux_udev.c10
-rw-r--r--libusb/version_nano.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/libusb/os/linux_udev.c b/libusb/os/linux_udev.c
index abecdd4..9d8fb0f 100644
--- a/libusb/os/linux_udev.c
+++ b/libusb/os/linux_udev.c
@@ -119,17 +119,17 @@ int linux_udev_stop_event_monitor(void)
assert(udev_monitor != NULL);
assert(udev_monitor_fd != -1);
- /* Release the udev monitor */
- udev_monitor_unref(udev_monitor);
- udev_monitor = NULL;
- udev_monitor_fd = -1;
-
/* Cancel the event thread. This is the only way to garauntee the
thread exits since closing the monitor fd won't necessarily cause
poll to return. */
pthread_cancel(linux_event_thread);
pthread_join(linux_event_thread, NULL);
+ /* Release the udev monitor */
+ udev_monitor_unref(udev_monitor);
+ udev_monitor = NULL;
+ udev_monitor_fd = -1;
+
/* Clean up the udev context */
udev_unref(udev_ctx);
udev_ctx = NULL;
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 3d5965f..1703d21 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 10738
+#define LIBUSB_NANO 10739