From 5c86700fd7b5525406cdcc5d1b16ca4cf8874acd Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Sun, 29 Oct 2023 19:46:02 +0100 Subject: [PATCH] lib/utmp.c: Don't check for NULL before free(3) free(NULL) is valid; there's no need to check for NULL. Simplify. Fixes: 5178f8c5afb6 ("utmp: call prepare_utmp() even if utent is NULL") Signed-off-by: Alejandro Colomar --- lib/utmp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/utmp.c b/lib/utmp.c index e0ae48a08..43eb2f5df 100644 --- a/lib/utmp.c +++ b/lib/utmp.c @@ -374,10 +374,8 @@ int update_utmp (const char *user, (void) setutmp (ut); /* make entry in the utmp & wtmp files */ - if (utent != NULL) { - free (utent); - } - free (ut); + free(utent); + free(ut); return 0; } -- 2.47.2