From e59ba56d78312be9ed56e9ed94c16a7ac05514c0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 22 Mar 2019 19:21:48 +0100 Subject: [PATCH] core: remove unnecessary heap allocation --- src/core/dbus-unit.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 28ae6070a60..0afa9e23c00 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -319,9 +319,8 @@ int bus_unit_method_start_generic( bool reload_if_possible, sd_bus_error *error) { - const char *smode; + const char *smode, *verb; JobMode mode; - _cleanup_free_ char *verb = NULL; static const char *const polkit_message_for_job[_JOB_TYPE_MAX] = { [JOB_START] = N_("Authentication is required to start '$(unit)'."), [JOB_STOP] = N_("Authentication is required to stop '$(unit)'."), @@ -351,11 +350,9 @@ int bus_unit_method_start_generic( return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Job mode %s invalid", smode); if (reload_if_possible) - verb = strjoin("reload-or-", job_type_to_string(job_type)); + verb = strjoina("reload-or-", job_type_to_string(job_type)); else - verb = strdup(job_type_to_string(job_type)); - if (!verb) - return -ENOMEM; + verb = job_type_to_string(job_type); r = bus_verify_manage_units_async_full( u, -- 2.47.3