From: Mike Yuan Date: Tue, 10 Jan 2023 17:26:24 +0000 (+0800) Subject: core/transaction: modernize to use cleanup attribute X-Git-Tag: v253-rc1~64^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fd55b2e599564a9a97890697e7e40df5d2b4745e;p=thirdparty%2Fsystemd.git core/transaction: modernize to use cleanup attribute --- diff --git a/src/core/transaction.c b/src/core/transaction.c index fe8ba8d903e..6beca0e6c47 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -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) {