summaryrefslogtreecommitdiffstats
path: root/login-utils/last.c
diff options
context:
space:
mode:
authorSami Kerola2013-09-08 18:09:06 +0200
committerKarel Zak2013-09-10 12:57:31 +0200
commitbce5163b68962ff8b76bacc62fb664e662e67598 (patch)
tree2998fc3afe132cf6e01c4871640d057842cc2017 /login-utils/last.c
parentlib/strutils: optimalize {starts,ends}with() (diff)
downloadkernel-qcow2-util-linux-bce5163b68962ff8b76bacc62fb664e662e67598.tar.gz
kernel-qcow2-util-linux-bce5163b68962ff8b76bacc62fb664e662e67598.tar.xz
kernel-qcow2-util-linux-bce5163b68962ff8b76bacc62fb664e662e67598.zip
last: fix memory leak
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'login-utils/last.c')
-rw-r--r--login-utils/last.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/login-utils/last.c b/login-utils/last.c
index eb64bde6a..bc1b4ce0d 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -819,6 +819,10 @@ static void process_wtmp_file(const struct last_control *ctl)
printf(_("\n%s begins %s"), basename(ctl->altv[ctl->alti]), ctime(&begintime));
fclose(fp);
+ for (p = utmplist; p; p = next) {
+ next = p->next;
+ free(p);
+ }
}
int main(int argc, char **argv)