[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 3/5] nodedev: Clear the udev_monitor reference once unref'd



Since we only have one udev_monitor reference throughout libvirt, we
should either clear the pointer we copy around to prevent invalid memory
access once we unref this single reference, or start using reference
counting provided by libudev. This patch follows the former and only
clears the pointer.

Signed-off-by: Erik Skultety <eskultet redhat com>
---
 src/node_device/node_device_udev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index ea10dc3ce..cd19e79c1 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1581,6 +1581,7 @@ nodeStateCleanup(void)
         if (udev_monitor != NULL) {
             udev = udev_monitor_get_udev(udev_monitor);
             udev_monitor_unref(udev_monitor);
+            priv->udev_monitor = NULL;
         }
     }
 
-- 
2.13.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]