summaryrefslogtreecommitdiffstats
path: root/login-utils
diff options
context:
space:
mode:
authorKarel Zak2017-10-11 15:13:44 +0200
committerKarel Zak2017-10-11 15:13:44 +0200
commitbe642826658afc3c5c642b917414121cf6f9290e (patch)
tree973c1db7f0ef764314064eb14987136cb6ad1d53 /login-utils
parentlibsmartcols: don't call free_buffer() for uninitialized variable [coverity s... (diff)
downloadkernel-qcow2-util-linux-be642826658afc3c5c642b917414121cf6f9290e.tar.gz
kernel-qcow2-util-linux-be642826658afc3c5c642b917414121cf6f9290e.tar.xz
kernel-qcow2-util-linux-be642826658afc3c5c642b917414121cf6f9290e.zip
lslogins: fix possible memory leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils')
-rw-r--r--login-utils/lslogins.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
index 5d896d73c..1042b9b41 100644
--- a/login-utils/lslogins.c
+++ b/login-utils/lslogins.c
@@ -606,12 +606,12 @@ static struct lslogins_user *get_user_info(struct lslogins_control *ctl, const c
return NULL;
}
- user = xcalloc(1, sizeof(struct lslogins_user));
-
grp = getgrgid(pwd->pw_gid);
if (!grp)
return NULL;
+ user = xcalloc(1, sizeof(struct lslogins_user));
+
if (ctl->wtmp)
user_wtmp = get_last_wtmp(ctl, pwd->pw_name);
if (ctl->btmp)