[PATCH 1/4] last: fix memory leak

Sami Kerola
2013-09-08T16:09:19Z

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
login-utils/last.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/login-utils/last.c b/login-utils/last.c
index eb64bde..bc1b4ce 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)
--
1.8.4