[glib] gunixmounts: Do not leak libmount tables in _g_get_unix_mounts()



commit b28c76b0d82b22ccde08999c2bc70dff0283e053
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Wed Jul 27 13:50:26 2016 -0600

    gunixmounts: Do not leak libmount tables in _g_get_unix_mounts()
    
    Use mnt_context_get_mtab instead of using mnt_context_get_table(), since
    that's the recommended way of accessing mtab/mountinfo information, and
    also because that way the (struct libmnt_table *) will get automatically
    deallocated when calling mnt_free_context()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769238

 gio/gunixmounts.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
---
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
index 58b71e9..d7e3511 100644
--- a/gio/gunixmounts.c
+++ b/gio/gunixmounts.c
@@ -391,11 +391,7 @@ _g_get_unix_mounts (void)
   GList *return_list = NULL;
 
   ctxt = mnt_new_context ();
-  mnt_context_get_table (ctxt, PROC_MOUNTINFO_PATH, &table);
-  if (!table)
-    mnt_context_get_mtab (ctxt, &table);
-
-  /* Not much to do if neither mountinfo nor mtab are available */
+  mnt_context_get_mtab (ctxt, &table);
   if (!table)
     return NULL;
 


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