diff options
author | Sami Kerola | 2018-12-10 21:14:12 +0100 |
---|---|---|
committer | Sami Kerola | 2018-12-10 21:25:58 +0100 |
commit | e361253e886424cbe37693d92eb368a595fd9e9a (patch) | |
tree | f0efe72ccd89f63659f2fc46f6937c78d57a2ec5 /misc-utils/lsblk.c | |
parent | libmount: (umount) make mnt_stat_mountpoin() usable for relative paths (diff) | |
download | kernel-qcow2-util-linux-e361253e886424cbe37693d92eb368a595fd9e9a.tar.gz kernel-qcow2-util-linux-e361253e886424cbe37693d92eb368a595fd9e9a.tar.xz kernel-qcow2-util-linux-e361253e886424cbe37693d92eb368a595fd9e9a.zip |
lsblk: fix null pointer dereferences
Both catched with -Wnull-dereference compiler option:
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r-- | misc-utils/lsblk.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 7ee6dff90..ffa1f82bf 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -747,7 +747,7 @@ static char *device_get_data( case COL_OWNER: { struct stat *st = device_get_stat(dev); - struct passwd *pw = st ? NULL : getpwuid(st->st_uid); + struct passwd *pw = st ? getpwuid(st->st_uid) : NULL; if (pw) str = xstrdup(pw->pw_name); break; @@ -755,7 +755,7 @@ static char *device_get_data( case COL_GROUP: { struct stat *st = device_get_stat(dev); - struct group *gr = st ? NULL : getgrgid(st->st_gid); + struct group *gr = st ? getgrgid(st->st_gid) : NULL; if (gr) str = xstrdup(gr->gr_name); break; |