From bce5163b68962ff8b76bacc62fb664e662e67598 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 8 Sep 2013 17:09:06 +0100 Subject: [PATCH] last: fix memory leak Signed-off-by: Sami Kerola --- login-utils/last.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/login-utils/last.c b/login-utils/last.c index eb64bde6a8..bc1b4ce0d9 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) -- 2.47.3