diff options
author | David Tardon <dtardon@redhat.com> | 2018-10-09 17:26:19 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2018-10-12 14:51:35 +0200 |
commit | e99742ef3e9d847da04e71fec0eb426063b25068 (patch) | |
tree | 28c832c25531d849370075767b299812cc9fdaca /src/login/logind-utmp.c | |
parent | c05107767b589e9aac9711eb385738887f86eb77 (diff) | |
download | systemd-e99742ef3e9d847da04e71fec0eb426063b25068.tar.gz |
login: avoid leak of name returned by uid_to_name()
Diffstat (limited to 'src/login/logind-utmp.c')
-rw-r--r-- | src/login/logind-utmp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/login/logind-utmp.c b/src/login/logind-utmp.c index 71ebdfcfb1..8bdd4ab6bf 100644 --- a/src/login/logind-utmp.c +++ b/src/login/logind-utmp.c @@ -61,7 +61,7 @@ bool logind_wall_tty_filter(const char *tty, void *userdata) { static int warn_wall(Manager *m, usec_t n) { char date[FORMAT_TIMESTAMP_MAX] = {}; - _cleanup_free_ char *l = NULL; + _cleanup_free_ char *l = NULL, *username = NULL; usec_t left; int r; @@ -83,8 +83,8 @@ static int warn_wall(Manager *m, usec_t n) { return 0; } - utmp_wall(l, uid_to_name(m->scheduled_shutdown_uid), - m->scheduled_shutdown_tty, logind_wall_tty_filter, m); + username = uid_to_name(m->scheduled_shutdown_uid); + utmp_wall(l, username, m->scheduled_shutdown_tty, logind_wall_tty_filter, m); return 1; } |