]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/transaction: modernize to use cleanup attribute
authorMike Yuan <me@yhndnzj.com>
Tue, 10 Jan 2023 17:26:24 +0000 (01:26 +0800)
committerMike Yuan <me@yhndnzj.com>
Tue, 10 Jan 2023 17:34:32 +0000 (01:34 +0800)
src/core/transaction.c

index fe8ba8d903eb9ecf16d42bb66863a3b9c2ecb1cd..6beca0e6c476dc4efc72ef5a2f8951569b582856 100644 (file)
@@ -976,11 +976,11 @@ int transaction_add_job_and_dependencies(
         }
 
         if (is_new && !ignore_requirements && type != JOB_NOP) {
-                Set *following;
+                _cleanup_set_free_ Set *following = NULL;
 
                 /* If we are following some other unit, make sure we
                  * add all dependencies of everybody following. */
-                if (unit_following_set(ret->unit, &following) > 0) {
+                if (unit_following_set(ret->unit, &following) > 0)
                         SET_FOREACH(dep, following) {
                                 r = transaction_add_job_and_dependencies(tr, type, dep, ret, false, false, false, ignore_order, e);
                                 if (r < 0) {
@@ -991,9 +991,6 @@ int transaction_add_job_and_dependencies(
                                 }
                         }
 
-                        set_free(following);
-                }
-
                 /* Finally, recursively add in all dependencies. */
                 if (IN_SET(type, JOB_START, JOB_RESTART)) {
                         UNIT_FOREACH_DEPENDENCY(dep, ret->unit, UNIT_ATOM_PULL_IN_START) {