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

index 6c4cb6ec9de8acf96011a71a1a5326a92730f294..1aec2783f186f7f03ce6016ace1600d34cbb2a4a 100644 (file)
@@ -316,6 +316,8 @@ int bus_image_common_attach(
         assert(message);
         assert(name_or_path || image);
 
+        CLEANUP_ARRAY(changes, n_changes, portable_changes_free);
+
         if (!m) {
                 assert(image);
                 m = image->userdata;
@@ -390,13 +392,9 @@ int bus_image_common_attach(
                         &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);
 }
 
 static int bus_image_method_attach(sd_bus_message *message, void *userdata, sd_bus_error *error) {