logind: rework Seat/Session/User object allocation and freeing a bit
authorLennart Poettering <lennart@poettering.net>
Fri, 3 Aug 2018 16:53:09 +0000 (18:53 +0200)
committerThe Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>
Fri, 20 Aug 2021 11:06:37 +0000 (13:06 +0200)
commit019b3a5d7530c51aa8f7f1e5f5cb5eb81113d4db
tree99e5d7747c30e9ee5bf78d4abe86627110484a38
parent3cf73fa4599116da350a0100378e749bbcbcad37
logind: rework Seat/Session/User object allocation and freeing a bit

Let's update things a bit to follow current practices:

- User structure initialization rather than zero-initialized allocation

- Always propagate proper errors from allocation functions

- Use _cleanup_ for freeing objects when allocation fails half-way

- Make destructors return NULL

(cherry picked from commit 8c29a4570993105fecc12288596d2ee77c7f82b8)

Related: #1642460
src/login/logind-core.c
src/login/logind-seat.c
src/login/logind-seat.h
src/login/logind-session.c
src/login/logind-session.h
src/login/logind-user.c