[gnome-settings-daemon] updates: Prevent a crash if an inserted device requires firmware but is removed before the search co



commit abba65433b7f637a18736033e39bdec1666642ce
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jul 2 09:52:29 2012 +0100

    updates: Prevent a crash if an inserted device requires firmware but is removed before the search completes

 plugins/updates/gsd-updates-firmware.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/plugins/updates/gsd-updates-firmware.c b/plugins/updates/gsd-updates-firmware.c
index 140a86d..52715e6 100644
--- a/plugins/updates/gsd-updates-firmware.c
+++ b/plugins/updates/gsd-updates-firmware.c
@@ -140,7 +140,8 @@ request_new (const gchar *filename, const gchar *sysfs_path)
         id_product = g_udev_device_get_property (device, "ID_MODEL_ID");
         req->id = g_strdup_printf ("%s_%s", id_vendor, id_product);
 out:
-        g_object_unref (device);
+        if (device != NULL)
+                g_object_unref (device);
         g_object_unref (client);
 #endif
         return req;
@@ -690,6 +691,8 @@ remove_ignored (GsdUpdatesFirmware *firmware, GPtrArray *array)
         /* remove any ignored pattern matches */
         for (i=0; i<array->len; i++) {
                 req = g_ptr_array_index (array, i);
+                if (req->id == NULL)
+                        continue;
                 for (j=0; ignored[j] != NULL; j++) {
                         ret = g_pattern_match_simple (ignored[j], req->id);
                         if (ret) {



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