[mutter] meta-launcher: don't call g_object_unref() on NULL
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] meta-launcher: don't call g_object_unref() on NULL
- Date: Thu, 21 Jan 2016 13:14:15 +0000 (UTC)
commit e7a88dc6b2eed37d513cf33396d6cf35e8a049cc
Author: Marek Chalupa <mchqwerty gmail com>
Date: Tue Dec 15 17:47:12 2015 +0100
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
src/backends/native/meta-launcher.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c
index 34480cd..7cd338b 100644
--- a/src/backends/native/meta-launcher.c
+++ b/src/backends/native/meta-launcher.c
@@ -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,11 +341,11 @@ 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_object_unref (pci_device);
+ }
}
g_list_free_full (devices, g_object_unref);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]