[gvfs] udisks2: Fix some memory leaks



commit d870015bff4eb8f34f465f4c45d91ca326f52a43
Author: David Zeuthen <davidz redhat com>
Date:   Mon Apr 9 11:42:08 2012 -0400

    udisks2: Fix some memory leaks
    
    https://bugzilla.redhat.com/show_bug.cgi?id=790062
    
    This was done using the following rather simple script
    
     #!/bin/bash
     while true; do
         losetup -f /home/davidz/Downloads/Fedora-16-x86_64-Live-Desktop.iso
         losetup -D
     done
    
    and then running it as root.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 monitor/udisks2/gvfsudisks2volumemonitor.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/monitor/udisks2/gvfsudisks2volumemonitor.c b/monitor/udisks2/gvfsudisks2volumemonitor.c
index 58d121c..3d5cbd5 100644
--- a/monitor/udisks2/gvfsudisks2volumemonitor.c
+++ b/monitor/udisks2/gvfsudisks2volumemonitor.c
@@ -593,6 +593,13 @@ get_mount_point_for_mount (GUnixMountEntry *mount_entry)
     }
 
  out:
+  for (l = mount_points; l != NULL; l = l->next)
+    {
+      GUnixMountPoint *mount_point = l->data;
+      if (G_LIKELY (mount_point != ret))
+        g_unix_mount_point_free (mount_point);
+    }
+  g_list_free (mount_points);
   return ret;
 }
 
@@ -700,6 +707,7 @@ should_include_mount (GVfsUDisks2VolumeMonitor  *monitor,
   if (mount_point != NULL)
     {
       ret = should_include_mount_point (monitor, mount_point);
+      g_unix_mount_point_free (mount_point);
       goto out;
     }
 
@@ -1500,6 +1508,7 @@ update_fstab_volumes (GVfsUDisks2VolumeMonitor  *monitor,
           !mount_point_has_device (monitor, mount_point))
         {
           new_mount_points = g_list_remove_link (new_mount_points, l);
+          g_unix_mount_point_free (mount_point);
         }
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]