diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-09-11 20:29:34 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-09-11 20:29:34 +0900 |
commit | 594c383554798c34616eb5d8dc1bc00cafaaf06b (patch) | |
tree | 784aab8f95e852b8938b24e32151a074d1a7ecf1 /src/basic | |
parent | dccdbf9b35f6ab536b19685d7b194cb0d636da6e (diff) | |
download | systemd-594c383554798c34616eb5d8dc1bc00cafaaf06b.tar.gz |
cgroup-util: use string_hash_ops_free
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/cgroup-util.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 7dd8e4e0fc..9ba9f375b0 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -2001,7 +2001,7 @@ int cg_mask_supported(CGroupMask *ret) { } int cg_kernel_controllers(Set **ret) { - _cleanup_set_free_free_ Set *controllers = NULL; + _cleanup_set_free_ Set *controllers = NULL; _cleanup_fclose_ FILE *f = NULL; int r; @@ -2011,10 +2011,6 @@ int cg_kernel_controllers(Set **ret) { * and controllers that aren't currently accessible (because not mounted). This does not include "name=" * pseudo-controllers. */ - controllers = set_new(&string_hash_ops); - if (!controllers) - return -ENOMEM; - r = fopen_unlocked("/proc/cgroups", "re", &f); if (r == -ENOENT) { *ret = NULL; @@ -2048,7 +2044,7 @@ int cg_kernel_controllers(Set **ret) { if (!cg_controller_is_valid(controller)) return -EBADMSG; - r = set_consume(controllers, TAKE_PTR(controller)); + r = set_ensure_consume(&controllers, &string_hash_ops_free, TAKE_PTR(controller)); if (r < 0) return r; } |