#include <errno.h>
#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <unistd.h>
#include "sd-daemon.h"
#include "alloc-util.h"
#include "bus-error.h"
-#include "bus-util.h"
+#include "bus-polkit.h"
#include "cgroup-util.h"
#include "dirent-util.h"
#include "fd-util.h"
static Manager* manager_unref(Manager *m);
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_unref);
-DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(machine_hash_ops, void, trivial_hash_func, trivial_compare_func,
- Machine, machine_free);
+DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(machine_hash_ops, char, string_hash_func, string_compare_func, Machine, machine_free);
static int manager_new(Manager **ret) {
_cleanup_(manager_unrefp) Manager *m = NULL;
if (!m)
return -ENOMEM;
- m->machines = hashmap_new(&string_hash_ops);
+ m->machines = hashmap_new(&machine_hash_ops);
m->machine_units = hashmap_new(&string_hash_ops);
- m->machine_leaders = hashmap_new(&machine_hash_ops);
+ m->machine_leaders = hashmap_new(NULL);
if (!m->machines || !m->machine_units || !m->machine_leaders)
return -ENOMEM;
assert(m->n_operations == 0);
- hashmap_free(m->machines);
+ hashmap_free(m->machines); /* This will free all machines, so that the machine_units/machine_leaders is empty */
hashmap_free(m->machine_units);
hashmap_free(m->machine_leaders);
hashmap_free(m->image_cache);
sd_event_source_unref(m->image_cache_defer_event);
+ sd_event_source_unref(m->nscd_cache_flush_event);
bus_verify_polkit_async_registry_free(m->polkit_registry);
- sd_bus_unref(m->bus);
+ sd_bus_flush_close_unref(m->bus);
sd_event_unref(m->event);
return mfree(m);