gunixmounts: Fix a potential strcmp(NULL) call

mntent->mnt_fsname may be NULL at this point; if so, fall to the second
branch and set mount_entry->device_path = NULL.

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=113075
This commit is contained in:
Philip Withnall 2013-11-26 11:16:57 +00:00
parent 8b9e8dc53b
commit 73e6b900d4

View File

@ -418,7 +418,7 @@ _g_get_unix_mounts (void)
mount_entry = g_new0 (GUnixMountEntry, 1);
mount_entry->mount_path = g_strdup (mntent->mnt_dir);
if (strcmp (mntent->mnt_fsname, "/dev/root") == 0)
if (g_strcmp0 (mntent->mnt_fsname, "/dev/root") == 0)
mount_entry->device_path = g_strdup (_resolve_dev_root ());
else
mount_entry->device_path = g_strdup (mntent->mnt_fsname);