From 73e6b900d431f8ef948aa134e45107bd326e8004 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 26 Nov 2013 11:16:57 +0000 Subject: [PATCH] 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 --- gio/gunixmounts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c index 03f1720ce..41565be72 100644 --- a/gio/gunixmounts.c +++ b/gio/gunixmounts.c @@ -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);