[ShellGlobal] Fix double-free in get_primary_monitor

This commit is contained in:
Colin Walters 2010-04-05 11:39:37 -04:00
parent bae07700a1
commit cbcbd11ba0

View File

@ -1113,17 +1113,17 @@ shell_global_get_primary_monitor (ShellGlobal *global)
{ {
/* Prefer the laptop's internal screen if present */ /* Prefer the laptop's internal screen if present */
output_name = gdk_screen_get_monitor_plug_name (screen, i); output_name = gdk_screen_get_monitor_plug_name (screen, i);
if (output_name && g_ascii_strncasecmp (output_name, "LVDS", 4) == 0) if (output_name)
{
gboolean is_lvds = g_ascii_strncasecmp (output_name, "LVDS", 4) == 0;
g_free (output_name);
if (is_lvds)
{ {
primary = i; primary = i;
break; break;
} }
if (output_name)
g_free (output_name);
} }
}
if (output_name)
g_free (output_name);
gdk_screen_get_monitor_geometry (screen, primary, &rect); gdk_screen_get_monitor_geometry (screen, primary, &rect);