X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fmanager.c;h=e0c1cd187e87db3d5aca127b083bcb8a30cf9475;hb=cb87a73b45503eaa6bead291423a529b00d27156;hp=9abdf475cf1ea9404a21a409837680eaee16daf2;hpb=d81afec1c9bf4b73e3df8996d65ecae95d19b6db;p=elogind.git diff --git a/src/core/manager.c b/src/core/manager.c index 9abdf475c..e0c1cd187 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -449,27 +449,27 @@ int manager_new(SystemdRunningAs running_as, bool test_run, Manager **_m) { if (r < 0) goto fail; - r = hashmap_ensure_allocated(&m->units, string_hash_func, string_compare_func); + r = hashmap_ensure_allocated(&m->units, &string_hash_ops); if (r < 0) goto fail; - r = hashmap_ensure_allocated(&m->jobs, trivial_hash_func, trivial_compare_func); + r = hashmap_ensure_allocated(&m->jobs, NULL); if (r < 0) goto fail; - r = hashmap_ensure_allocated(&m->cgroup_unit, string_hash_func, string_compare_func); + r = hashmap_ensure_allocated(&m->cgroup_unit, &string_hash_ops); if (r < 0) goto fail; - r = hashmap_ensure_allocated(&m->watch_bus, string_hash_func, string_compare_func); + r = hashmap_ensure_allocated(&m->watch_bus, &string_hash_ops); if (r < 0) goto fail; - r = set_ensure_allocated(&m->startup_units, trivial_hash_func, trivial_compare_func); + r = set_ensure_allocated(&m->startup_units, NULL); if (r < 0) goto fail; - r = set_ensure_allocated(&m->failed_units, trivial_hash_func, trivial_compare_func); + r = set_ensure_allocated(&m->failed_units, NULL); if (r < 0) goto fail; @@ -896,14 +896,14 @@ static int manager_coldplug(Manager *m) { static void manager_build_unit_path_cache(Manager *m) { char **i; - _cleanup_free_ DIR *d = NULL; + _cleanup_closedir_ DIR *d = NULL; int r; assert(m); set_free_free(m->unit_path_cache); - m->unit_path_cache = set_new(string_hash_func, string_compare_func); + m->unit_path_cache = set_new(&string_hash_ops); if (!m->unit_path_cache) { log_error("Failed to allocate unit path cache."); return; @@ -2751,8 +2751,10 @@ int manager_environment_add(Manager *m, char **minus, char **plus) { if (!strv_isempty(plus)) { b = strv_env_merge(2, l, plus); - if (!b) + if (!b) { + strv_free(a); return -ENOMEM; + } l = b; }