From: Alejandro Colomar Date: Sun, 29 Oct 2023 18:46:02 +0000 (+0100) Subject: lib/utmp.c: Don't check for NULL before free(3) X-Git-Tag: 4.15.0-rc1~142 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c86700fd7b5525406cdcc5d1b16ca4cf8874acd;p=thirdparty%2Fshadow.git 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 --- 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; }