summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2014-09-26 11:25:24 +0200
committerKarel Zak <kzak@redhat.com>2014-10-24 10:23:06 +0200
commite2816a1ae0a77448af8cb2e5e5365ba984351881 (patch)
tree88c26d5f67eea9c99c762cf52e6fe3cf34c69ee4
parent8083886768020a0235df2a267c02ecbd83c05f72 (diff)
downloadutil-linux-e2816a1ae0a77448af8cb2e5e5365ba984351881.tar.gz
lslogins: free after error [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--lib/readutmp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/readutmp.c b/lib/readutmp.c
index 4e8a0845c..b11e9a4d2 100644
--- a/lib/readutmp.c
+++ b/lib/readutmp.c
@@ -64,8 +64,10 @@ read_utmp (char const *file, size_t *n_entries, struct utmp **utmp_buf)
}
utmp[n_read++] = *u;
}
- if (!u && errno)
+ if (!u && errno) {
+ free(utmp);
return -1;
+ }
endutent();