diff options
author | David Tardon <dtardon@redhat.com> | 2023-03-28 13:44:16 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2023-04-11 16:32:48 +0200 |
commit | f86a41291b6395b9fb74ccd74911ad7867d81dd9 (patch) | |
tree | a9daf0c1a872c627d6a9399be068ab863a7e2ec6 /src | |
parent | a5290effe8cc8fef9793d3371a430f11d6dc39e1 (diff) | |
download | systemd-f86a41291b6395b9fb74ccd74911ad7867d81dd9.tar.gz |
portabled-image-bus: use CLEANUP_ARRAY
Diffstat (limited to 'src')
-rw-r--r-- | src/portable/portabled-image-bus.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/portable/portabled-image-bus.c b/src/portable/portabled-image-bus.c index 45dd4ec5ee..190bee6d17 100644 --- a/src/portable/portabled-image-bus.c +++ b/src/portable/portabled-image-bus.c @@ -644,6 +644,10 @@ int bus_image_common_reattach( assert(message); assert(name_or_path || image); + CLEANUP_ARRAY(changes_detached, n_changes_detached, portable_changes_free); + CLEANUP_ARRAY(changes_attached, n_changes_attached, portable_changes_free); + CLEANUP_ARRAY(changes_gone, n_changes_gone, portable_changes_free); + if (!m) { assert(image); m = image->userdata; @@ -717,7 +721,7 @@ int bus_image_common_reattach( &n_changes_detached, error); if (r < 0) - goto finish; + return r; r = portable_attach( sd_bus_message_get_bus(message), @@ -730,7 +734,7 @@ int bus_image_common_reattach( &n_changes_attached, error); if (r < 0) - goto finish; + return r; /* We want to return the list of units really removed by the detach, * and not added again by the attach */ @@ -738,22 +742,14 @@ int bus_image_common_reattach( changes_detached, n_changes_detached, &changes_gone, &n_changes_gone); if (r < 0) - goto finish; + return r; /* First, return the units that are gone (so that the caller can stop them) * Then, return the units that are changed/added (so that the caller can * start/restart/enable them) */ - r = reply_portable_changes_pair(message, - changes_gone, n_changes_gone, - changes_attached, n_changes_attached); - if (r < 0) - goto finish; - -finish: - portable_changes_free(changes_detached, n_changes_detached); - portable_changes_free(changes_attached, n_changes_attached); - portable_changes_free(changes_gone, n_changes_gone); - return r; + return reply_portable_changes_pair(message, + changes_gone, n_changes_gone, + changes_attached, n_changes_attached); } static int bus_image_method_reattach(sd_bus_message *message, void *userdata, sd_bus_error *error) { |