Public bug reported:

in plugins/orientation/gsd-orientation-manager.c mpu_timer(), the code
is leaking g_build_filename() calls. The implication of this leak is
severe since it's called very often. The graph attached show evolution
of memory usage of g-s-d over a period of 10h or so and g-s-d leaked 9MB
during that time.

a proposed patch:
--- gsd-orientation-manager.c.orig      2013-02-12 12:31:34.000000000 +0100
+++ gsd-orientation-manager.c   2013-02-13 10:35:19.496823747 +0100
@@ -438,13 +438,19 @@
 static gboolean mpu_timer(GsdOrientationManager *manager) {
        int x, y;
        static gboolean first = TRUE;
+       gchar *filename_x = NULL;
+       gchar *filename_y = NULL;
        OrientationUp orientation = manager->priv->prev_orientation;
 
         if (manager->priv->xrandr_proxy == NULL)
                 return TRUE;
 
-       x = read_sysfs_attr_as_int(g_build_filename(manager->priv->sysfs_path, 
"in_accel_x_raw", NULL));
-       y = read_sysfs_attr_as_int(g_build_filename(manager->priv->sysfs_path, 
"in_accel_y_raw", NULL));
+       filename_x = g_build_filename(manager->priv->sysfs_path, 
"in_accel_x_raw", NULL);
+       filename_y = g_build_filename(manager->priv->sysfs_path, 
"in_accel_y_raw", NULL);
+       x = read_sysfs_attr_as_int(filename_x);
+       y = read_sysfs_attr_as_int(filename_y);
+       g_free(filename_x);
+       g_free(filename_y);
 
        if (x > MPU_THRESHOLD)
                orientation = ORIENTATION_NORMAL;

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: gnome-settings-daemon 3.6.4-0ubuntu5
ProcVersionSignature: Ubuntu 3.8.0-5.10-generic 3.8.0-rc6
Uname: Linux 3.8.0-5-generic x86_64
ApportVersion: 2.8-0ubuntu4
Architecture: amd64
Date: Wed Feb 13 10:36:35 2013
MarkForUpload: True
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: gnome-settings-daemon
UpgradeStatus: Upgraded to raring on 2012-01-31 (378 days ago)

** Affects: ubuntu-nexus7
     Importance: Undecided
         Status: New

** Affects: gnome-settings-daemon (Ubuntu)
     Importance: High
     Assignee: Jani Monoses (jani)
         Status: New


** Tags: amd64 apport-bug qa-manual-testing raring running-unity

** Attachment added: "g-s-d_leak.png"
   
https://bugs.launchpad.net/bugs/1123930/+attachment/3526257/+files/g-s-d_leak.png

** Also affects: ubuntu-nexus7
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gnome-settings-daemon in Ubuntu.
https://bugs.launchpad.net/bugs/1123930

Title:
  memleak in plugins/orientation/gsd-orientation-manager.c

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-nexus7/+bug/1123930/+subscriptions

-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to