meta-launcher: don't call g_object_unref() on NULL

g_object_unref() was called no matter what we got for value

https://bugzilla.gnome.org/show_bug.cgi?id=760670
This commit is contained in:
Marek Chalupa 2015-12-15 17:47:12 +01:00 committed by Rui Matos
parent bcdda506e1
commit e7a88dc6b2

View File

@ -295,7 +295,7 @@ get_primary_gpu_path (const gchar *seat_name)
if (!devices)
goto out;
for (tmp = devices; tmp != NULL && path == NULL; tmp = tmp->next)
for (tmp = devices; tmp != NULL; tmp = tmp->next)
{
GUdevDevice *platform_device = NULL, *pci_device = NULL;
GUdevDevice *dev = tmp->data;
@ -325,13 +325,15 @@ get_primary_gpu_path (const gchar *seat_name)
continue;
platform_device = g_udev_device_get_parent_with_subsystem (dev, "platform", NULL);
pci_device = g_udev_device_get_parent_with_subsystem (dev, "pci", NULL);
if (platform_device != NULL)
{
path = g_strdup (g_udev_device_get_device_file (dev));
g_object_unref (platform_device);
break;
}
else if (pci_device != NULL)
pci_device = g_udev_device_get_parent_with_subsystem (dev, "pci", NULL);
if (pci_device != NULL)
{
/* get value of boot_vga attribute or 0 if the device has no boot_vga */
boot_vga = g_udev_device_get_sysfs_attr_as_int (pci_device, "boot_vga");
@ -339,12 +341,12 @@ get_primary_gpu_path (const gchar *seat_name)
{
/* found the boot_vga device */
path = g_strdup (g_udev_device_get_device_file (dev));
}
break;
}
g_object_unref (platform_device);
g_object_unref (pci_device);
}
}
g_list_free_full (devices, g_object_unref);