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
This commit is contained in:
Mario Sanchez Prada 2016-07-27 13:50:26 -06:00
parent 7cf037ec16
commit b28c76b0d8

View File

@ -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;