summaryrefslogtreecommitdiffstats
path: root/src/home/homed-manager.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-12-14 11:37:27 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-12-14 12:00:24 +0100
commit76fc1577023b524302ea44e5bfffbd0074a2271d (patch)
treee08bc75377414a9c72fc9f37b162e5d32e6af5ac /src/home/homed-manager.c
parentpolkit: make bus_verify_polkit_async_registry_free() return Hashmap* with NULL (diff)
downloadsystemd-76fc1577023b524302ea44e5bfffbd0074a2271d.tar.xz
systemd-76fc1577023b524302ea44e5bfffbd0074a2271d.zip
home: clear Manager::bus, ::event, ::homes_by_xxx and so on
`home_free()` may try to call some dbus or event related functions. To prevent that, set those variables NULL.
Diffstat (limited to '')
-rw-r--r--src/home/homed-manager.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/home/homed-manager.c b/src/home/homed-manager.c
index d49fcedb57..2595e96016 100644
--- a/src/home/homed-manager.c
+++ b/src/home/homed-manager.c
@@ -253,8 +253,8 @@ Manager* manager_free(Manager *m) {
HASHMAP_FOREACH(h, m->homes_by_worker_pid)
(void) home_wait_for_worker(h);
- sd_bus_flush_close_unref(m->bus);
- bus_verify_polkit_async_registry_free(m->polkit_registry);
+ m->bus = sd_bus_flush_close_unref(m->bus);
+ m->polkit_registry = bus_verify_polkit_async_registry_free(m->polkit_registry);
m->device_monitor = sd_device_monitor_unref(m->device_monitor);
@@ -265,12 +265,12 @@ Manager* manager_free(Manager *m) {
m->deferred_auto_login_event_source = sd_event_source_unref(m->deferred_auto_login_event_source);
m->rebalance_event_source = sd_event_source_unref(m->rebalance_event_source);
- sd_event_unref(m->event);
+ m->event = sd_event_unref(m->event);
- hashmap_free(m->homes_by_uid);
- hashmap_free(m->homes_by_name);
- hashmap_free(m->homes_by_worker_pid);
- hashmap_free(m->homes_by_sysfs);
+ m->homes_by_uid = hashmap_free(m->homes_by_uid);
+ m->homes_by_name = hashmap_free(m->homes_by_name);
+ m->homes_by_worker_pid = hashmap_free(m->homes_by_worker_pid);
+ m->homes_by_sysfs = hashmap_free(m->homes_by_sysfs);
if (m->private_key)
EVP_PKEY_free(m->private_key);