summaryrefslogtreecommitdiff
path: root/src/core/slice.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/slice.c')
-rw-r--r--src/core/slice.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/core/slice.c b/src/core/slice.c
index c505fa1916..ed5d3fd701 100644
--- a/src/core/slice.c
+++ b/src/core/slice.c
@@ -299,16 +299,9 @@ static void slice_enumerate(Manager *m) {
u = manager_get_unit(m, SPECIAL_ROOT_SLICE);
if (!u) {
- u = unit_new(m, sizeof(Slice));
- if (!u) {
- log_oom();
- return;
- }
-
- r = unit_add_name(u, SPECIAL_ROOT_SLICE);
+ r = unit_new_for_name(m, sizeof(Slice), SPECIAL_ROOT_SLICE, &u);
if (r < 0) {
- unit_free(u);
- log_error_errno(r, "Failed to add the " SPECIAL_ROOT_SLICE " name: %m");
+ log_error_errno(r, "Failed to allocate the special " SPECIAL_ROOT_SLICE " unit: %m");
return;
}
}