From: Lennart Poettering Date: Fri, 22 Mar 2019 18:21:48 +0000 (+0100) Subject: core: remove unnecessary heap allocation X-Git-Tag: v242-rc1~74 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e59ba56d78312be9ed56e9ed94c16a7ac05514c0;p=thirdparty%2Fsystemd.git core: remove unnecessary heap allocation --- 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,