]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
portabled-image-bus: use CLEANUP_ARRAY
authorDavid Tardon <dtardon@redhat.com>
Tue, 28 Mar 2023 11:39:04 +0000 (13:39 +0200)
committerDavid Tardon <dtardon@redhat.com>
Tue, 11 Apr 2023 14:32:47 +0000 (16:32 +0200)
src/portable/portabled-image-bus.c

index 1aec2783f186f7f03ce6016ace1600d34cbb2a4a..45dd4ec5ee4a147bef0cc6f3099d5d3ab5ba1365 100644 (file)
@@ -416,6 +416,8 @@ static int bus_image_method_detach(
 
         assert(message);
 
+        CLEANUP_ARRAY(changes, n_changes, portable_changes_free);
+
         if (sd_bus_message_is_method_call(message, NULL, "DetachWithExtensions")) {
                 r = sd_bus_message_read_strv(message, &extension_images);
                 if (r < 0)
@@ -468,13 +470,9 @@ static int bus_image_method_detach(
                         &n_changes,
                         error);
         if (r < 0)
-                goto finish;
-
-        r = reply_portable_changes(message, changes, n_changes);
+                return r;
 
-finish:
-        portable_changes_free(changes, n_changes);
-        return r;
+        return reply_portable_changes(message, changes, n_changes);
 }
 
 int bus_image_common_remove(