From: David Tardon Date: Tue, 28 Mar 2023 08:39:33 +0000 (+0200) Subject: dbus-manager: use CLEANUP_ARRAY X-Git-Tag: v254-rc1~752^2~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2a711edd87e960a28b1c87e701522e05408426ed;p=thirdparty%2Fsystemd.git dbus-manager: use CLEANUP_ARRAY --- diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 096c3aef81a..cb73a57bf1f 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -2708,6 +2708,8 @@ static int method_get_unit_file_links(sd_bus_message *message, void *userdata, s const char *name; int runtime, r; + CLEANUP_ARRAY(changes, n_changes, install_changes_free); + r = sd_bus_message_read(message, "sb", &name, &runtime); if (r < 0) return r; @@ -2723,27 +2725,21 @@ static int method_get_unit_file_links(sd_bus_message *message, void *userdata, s r = unit_file_disable(m->runtime_scope, UNIT_FILE_DRY_RUN | (runtime ? UNIT_FILE_RUNTIME : 0), NULL, STRV_MAKE(name), &changes, &n_changes); - if (r < 0) { - log_error_errno(r, "Failed to get file links for %s: %m", name); - goto finish; - } + if (r < 0) + return log_error_errno(r, "Failed to get file links for %s: %m", name); for (i = 0; i < n_changes; i++) if (changes[i].type == INSTALL_CHANGE_UNLINK) { r = sd_bus_message_append(reply, "s", changes[i].path); if (r < 0) - goto finish; + return r; } r = sd_bus_message_close_container(reply); if (r < 0) - goto finish; - - r = sd_bus_send(NULL, reply, NULL); + return r; -finish: - install_changes_free(changes, n_changes); - return r; + return sd_bus_send(NULL, reply, NULL); } static int method_get_job_waiting(sd_bus_message *message, void *userdata, sd_bus_error *error) {