[mutter] meta-input-settings: Fix strv memleak in find_logical_monitor()



commit 5d2b0bc0cc28c384d528cdce8bf6b65f5e88b8b7
Author: Hans de Goede <hdegoede redhat com>
Date:   Mon Sep 18 12:34:14 2017 +0200

    meta-input-settings: Fix strv memleak in find_logical_monitor()
    
    The return value from g_settings_get_strv must be g_strfreev-ed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787836

 src/backends/meta-input-settings.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index 83c06ad..8130bf5 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -801,6 +801,7 @@ meta_input_settings_find_logical_monitor (MetaInputSettings  *input_settings,
 {
   MetaInputSettingsPrivate *priv;
   MetaMonitorManager *monitor_manager;
+  MetaLogicalMonitor *ret = NULL;
   guint n_values;
   GList *logical_monitors;
   GList *l;
@@ -815,11 +816,11 @@ meta_input_settings_find_logical_monitor (MetaInputSettings  *input_settings,
       g_warning ("EDID configuration for device '%s' "
                  "is incorrect, must have 3 values",
                  clutter_input_device_get_device_name (device));
-      return NULL;
+      goto out;
     }
 
   if (!*edid[0] && !*edid[1] && !*edid[2])
-    return NULL;
+    goto out;
 
   monitor_manager = priv->monitor_manager;
   logical_monitors =
@@ -833,10 +834,15 @@ meta_input_settings_find_logical_monitor (MetaInputSettings  *input_settings,
                                        edid[0],
                                        edid[1],
                                        edid[2]))
-        return logical_monitor;
+        {
+          ret = logical_monitor;
+          break;
+        }
     }
 
-  return NULL;
+out:
+  g_strfreev (edid);
+  return ret;
 }
 
 static void


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