summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-10-29 19:46:02 +0100
committerSerge Hallyn <serge@hallyn.com>2023-10-29 21:12:02 -0500
commit5c86700fd7b5525406cdcc5d1b16ca4cf8874acd (patch)
tree1dd4869753bd1d11dfc163d06d491cf7368c6910
parentb11129827a7e3e21e040974f0bd31b04d05e23f3 (diff)
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 <alx@kernel.org>
-rw-r--r--lib/utmp.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/utmp.c b/lib/utmp.c
index e0ae48a0..43eb2f5d 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;
}