From cbcbd11ba07e8ebe93aa6e83e5211bf62cb096be Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 5 Apr 2010 11:39:37 -0400 Subject: [PATCH] [ShellGlobal] Fix double-free in get_primary_monitor --- src/shell-global.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/shell-global.c b/src/shell-global.c index 8077b9d1f..3d7878064 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) - { - primary = i; - break; - } if (output_name) - g_free (output_name); + { + 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); - gdk_screen_get_monitor_geometry (screen, primary, &rect); return g_boxed_copy (GDK_TYPE_RECTANGLE, &rect);