Skip to content

Commit

Permalink
lib/utmp.c: Don't check for NULL before free(3)
Browse files Browse the repository at this point in the history
free(NULL) is valid; there's no need to check for NULL.  Simplify.

Fixes: 5178f8c ("utmp: call prepare_utmp() even if utent is NULL")
Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar authored and hallyn committed Oct 30, 2023
1 parent b111298 commit 5c86700
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/utmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5c86700

Please sign in to comment.