[gnome-shell] [ShellGlobal] Fix double-free in get_primary_monitor



commit cbcbd11ba07e8ebe93aa6e83e5211bf62cb096be
Author: Colin Walters <walters verbum org>
Date:   Mon Apr 5 11:39:37 2010 -0400

    [ShellGlobal] Fix double-free in get_primary_monitor

 src/shell-global.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/shell-global.c b/src/shell-global.c
index 8077b9d..3d78780 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -1113,18 +1113,18 @@ shell_global_get_primary_monitor (ShellGlobal  *global)
     {
       /* Prefer the laptop's internal screen if present */
       output_name = gdk_screen_get_monitor_plug_name (screen, i);
-      if (output_name && g_ascii_strncasecmp (output_name, "LVDS", 4) == 0)
+      if (output_name)
         {
-          primary = i;
-          break;
+          gboolean is_lvds = g_ascii_strncasecmp (output_name, "LVDS", 4) == 0;
+          g_free (output_name);
+          if (is_lvds)
+            {
+              primary = i;
+              break;
+            }
         }
-      if (output_name)
-       g_free (output_name);
     }
 
-  if (output_name)
-    g_free (output_name);
-
   gdk_screen_get_monitor_geometry (screen, primary, &rect);
 
   return g_boxed_copy (GDK_TYPE_RECTANGLE, &rect);



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