Bug#903901: GnomeRRScreen memory leak

Sam Morris sam at robots.org.uk
Mon Jul 16 12:57:22 BST 2018


Source: gnome-desktop3
Version: 3.14.1-1
Severity: normal
Tags: patch upstream

The attached patch fixes a memory leak in GnomeRRScreen. On my laptop
this causes clients to leak a few GiB of memory over a weekend!

This has been submitted upstream at
<https://gitlab.gnome.org/GNOME/gnome-desktop/merge_requests/1>.

-- System Information:
Debian Release: 9.5
  APT prefers stable-updates
  APT policy: (540, 'stable-updates'), (540, 'stable'), (520, 'testing'), (510, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 4.9.0-6-686-pae (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
-------------- next part --------------
--- gnome-desktop3-3.28.2.orig/libgnome-desktop/gnome-rr.c
+++ gnome-desktop3-3.28.2/libgnome-desktop/gnome-rr.c
@@ -487,17 +487,23 @@ fill_screen_info_from_resources (ScreenI
     /* Initialize */
     for (i = 0, crtc = info->crtcs; *crtc; ++i, ++crtc)
     {
-	crtc_initialize (*crtc, g_variant_get_child_value (crtcs, i));
+	GVariant *child = g_variant_get_child_value (crtcs, i);
+	crtc_initialize (*crtc, child);
+	g_variant_unref (child);
     }
 
     for (i = 0, output = info->outputs; *output; ++i, ++output)
     {
-	output_initialize (*output, g_variant_get_child_value (outputs, i));
+	GVariant *child = g_variant_get_child_value (outputs, i);
+	output_initialize (*output, child);
+	g_variant_unref (child);
     }
 
     for (i = 0, mode = info->modes; *mode; ++i, ++mode)
     {
-	mode_initialize (*mode, g_variant_get_child_value (modes, i));
+	GVariant *child = g_variant_get_child_value (modes, i);
+	mode_initialize (*mode, child);
+	g_variant_unref (child);
     }
 
     gather_clone_modes (info);
@@ -531,6 +537,11 @@ fill_out_screen_info (ScreenInfo  *info,
 
     fill_screen_info_from_resources (info, serial, crtcs, outputs,
 				     modes, max_width, max_height);
+
+    g_variant_unref (crtcs);
+    g_variant_unref (outputs);
+    g_variant_unref (modes);
+
     return TRUE;
 }
 
@@ -1420,6 +1431,8 @@ output_initialize (GnomeRROutput *output
 
     if (output->is_primary)
 	output->info->primary = output;
+
+    g_variant_unref (properties);
 }
 
 static GnomeRROutput*
@@ -1991,6 +2004,7 @@ crtc_initialize (GnomeRRCrtc *crtc, GVar
     
     while (g_variant_iter_loop (all_transforms, "u", &transform))
 	crtc->all_transforms |= 1 << transform;
+    g_variant_iter_free (all_transforms);
 }
 
 static void


More information about the pkg-gnome-maintainers mailing list