diff options
author | David Tardon <dtardon@redhat.com> | 2018-05-11 18:43:40 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-05-12 18:29:41 +0200 |
commit | 95f14a3e21b4d99383f37da9dc66021cf5ac22c2 (patch) | |
tree | 1bd855cd03c90d9f041900098e060465220fea2c /src/core/swap.c | |
parent | fee09fb7ac5d56a644445c528ca501d44e701755 (diff) | |
download | systemd-95f14a3e21b4d99383f37da9dc66021cf5ac22c2.tar.gz |
core: use automatic cleanup more
Diffstat (limited to 'src/core/swap.c')
-rw-r--r-- | src/core/swap.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/core/swap.c b/src/core/swap.c index 4d9f4df6ed..965d96f4da 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -1240,7 +1240,7 @@ static Unit *swap_following(Unit *u) { static int swap_following_set(Unit *u, Set **_set) { Swap *s = SWAP(u), *other; - Set *set; + _cleanup_(set_freep) Set *set = NULL; int r; assert(s); @@ -1258,15 +1258,11 @@ static int swap_following_set(Unit *u, Set **_set) { LIST_FOREACH_OTHERS(same_devnode, other, s) { 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 swap_shutdown(Manager *m) { |