gunixmounts: Fix crash if path doesn't exist

g_unix_mount_for segfaults for nonexistent paths. Return NULL if path
doesn't exist.

https://bugzilla.gnome.org/show_bug.cgi?id=772160
This commit is contained in:
Ondrej Holy 2016-10-24 20:13:22 +02:00 committed by Colin Walters
parent 1c47f62de7
commit b626a4677a

View File

@ -1471,8 +1471,11 @@ g_unix_mount_for (const char *file_path,
char *topdir;
topdir = _g_local_file_find_topdir_for (file_path);
entry = g_unix_mount_at (topdir, time_read);
g_free (topdir);
if (topdir != NULL)
{
entry = g_unix_mount_at (topdir, time_read);
g_free (topdir);
}
}
return entry;