log_error("Failed to insert '%s': %s", kmod_module_get_name(mod),
strerror(-r));
}
+
+ kmod_module_unref(mod);
}
kmod_module_unref_list(modlist);
return -ENOMEM;
}
+ m->kmod_ctx = kmod_new(NULL, NULL);
+ if (!m->kmod_ctx)
+ return -ENOMEM;
+
m->links = hashmap_new(uint64_hash_func, uint64_compare_func);
if (!m->links)
return -ENOMEM;
free(m->state_file);
+ kmod_unref(m->kmod_ctx);
udev_monitor_unref(m->udev_monitor);
udev_unref(m->udev);
sd_bus_unref(m->bus);
return r;
}
-
-int manager_init_kmod_ctx(Manager *m) {
- struct kmod_ctx *ctx;
-
- assert(m);
-
- ctx = kmod_new(NULL, NULL);
- if (!ctx) {
- return -ENOMEM;
- }
-
- m->kmod_ctx = ctx;
-
- return 0;
-}
goto out;
}
- r = manager_init_kmod_ctx(m);
- if (r < 0) {
- log_error("Could not init kmod context: %s", strerror(-r));
- goto out;
- }
-
r = manager_rtnl_enumerate_links(m);
if (r < 0) {
log_error("Could not enumerate links: %s", strerror(-r));
int manager_update_resolv_conf(Manager *m);
int manager_save(Manager *m);
-int manager_init_kmod_ctx(Manager *m);
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
#define _cleanup_manager_free_ _cleanup_(manager_freep)