From: Victor Toso <[email protected]>

As we must handle when GUdevClient creation can fails otherwise code
might crash.

Signed-off-by: Victor Toso <[email protected]>
Acked-by: Christophe Fergeau <[email protected]>
---
 src/usb-device-manager.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 3d4bd98..671a5be 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -321,6 +321,11 @@ static gboolean 
spice_usb_device_manager_initable_init(GInitable  *initable,
     /* Start listening for usb devices plug / unplug */
 #ifdef USE_GUDEV
     priv->udev = g_udev_client_new(subsystems, err);
+    if (priv->udev == NULL) {
+        const gchar *msg = (err != NULL && *err != NULL) ? (*err)->message : 
"";
+        g_warning("Error initializing GUdevClient due %s", msg);
+        return FALSE;
+    }
     g_signal_connect(G_OBJECT(priv->udev), "uevent",
                      G_CALLBACK(spice_usb_device_manager_uevent_cb), self);
     /* Do coldplug (detection of already connected devices) */
-- 
2.9.3

_______________________________________________
Spice-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to