#ifdef HAVE_WINDOW_SYSTEM
-# if (defined HAVE_NS \
- || (!defined USE_GTK && (defined HAVE_XINERAMA || defined HAVE_XRANDR)))
+# if (defined USE_GTK || defined HAVE_NS || defined HAVE_XINERAMA \
+ || defined HAVE_XRANDR)
void
free_monitors (struct MonitorInfo *monitors, int n_monitors)
{
mi->mm_height = height_mm;
#if GTK_CHECK_VERSION (3, 22, 0)
- mi->name = g_strdup (gdk_monitor_get_model (monitor));
+ mi->name = xstrdup (gdk_monitor_get_model (monitor));
#elif GTK_CHECK_VERSION (2, 14, 0)
mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
#endif
primary_monitor,
monitor_frames,
source);
+#if GTK_CHECK_VERSION (2, 14, 0)
+ free_monitors (monitors, n_monitors);
+#else
+ xfree (monitors)
+#endif
unblock_input ();
#else /* not USE_GTK */