]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/utmp.c: Don't check for NULL before free(3)
authorAlejandro Colomar <alx@kernel.org>
Sun, 29 Oct 2023 18:46:02 +0000 (19:46 +0100)
committerSerge Hallyn <serge@hallyn.com>
Mon, 30 Oct 2023 02:12:02 +0000 (21:12 -0500)
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 <alx@kernel.org>
lib/utmp.c

index e0ae48a0830448e1ec768fe4774aa6c8c49605c5..43eb2f5df9e487614fbdb59f806996a04a63c567 100644 (file)
@@ -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;
 }