portablectl: use CLEANUP_ARRAY
authorDavid Tardon <dtardon@redhat.com>
Tue, 28 Mar 2023 08:46:20 +0000 (10:46 +0200)
committerDavid Tardon <dtardon@redhat.com>
Tue, 11 Apr 2023 14:08:00 +0000 (16:08 +0200)
src/portable/portablectl.c

index d390a9295d7504e586dc93bad71434ec825deb06..751cef5731dc4f648a056da80259b72933256663 100644 (file)
@@ -548,6 +548,8 @@ static int maybe_enable_disable(sd_bus *bus, const char *path, bool enable) {
         size_t n_changes = 0;
         int r;
 
+        CLEANUP_ARRAY(changes, n_changes, install_changes_free);
+
         if (!arg_enable)
                 return 0;
 
@@ -585,7 +587,6 @@ static int maybe_enable_disable(sd_bus *bus, const char *path, bool enable) {
         }
 
         (void) bus_deserialize_and_dump_unit_file_changes(reply, arg_quiet, &changes, &n_changes);
-        install_changes_free(changes, n_changes);
 
         return 0;
 }