summaryrefslogtreecommitdiffstats
path: root/src/core/device.c
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2018-05-11 18:43:40 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-05-12 18:29:41 +0200
commit95f14a3e21b4d99383f37da9dc66021cf5ac22c2 (patch)
tree1bd855cd03c90d9f041900098e060465220fea2c /src/core/device.c
parentpo: uk: fixed missed word (diff)
downloadsystemd-95f14a3e21b4d99383f37da9dc66021cf5ac22c2.tar.xz
systemd-95f14a3e21b4d99383f37da9dc66021cf5ac22c2.zip
core: use automatic cleanup more
Diffstat (limited to 'src/core/device.c')
-rw-r--r--src/core/device.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/core/device.c b/src/core/device.c
index 565410fd36..0bf329c3d2 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -704,7 +704,7 @@ static Unit *device_following(Unit *u) {
static int device_following_set(Unit *u, Set **_set) {
Device *d = DEVICE(u), *other;
- Set *set;
+ _cleanup_(set_freep) Set *set = NULL;
int r;
assert(d);
@@ -722,21 +722,17 @@ static int device_following_set(Unit *u, Set **_set) {
LIST_FOREACH_AFTER(same_sysfs, other, d) {
r = set_put(set, other);
if (r < 0)
- goto fail;
+ return r;
}
LIST_FOREACH_BEFORE(same_sysfs, other, d) {
r = set_put(set, other);
if (r < 0)
- goto fail;
+ return r;
}
- *_set = set;
+ *_set = TAKE_PTR(set);
return 1;
-
-fail:
- set_free(set);
- return r;
}
static void device_shutdown(Manager *m) {