]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: remove unnecessary heap allocation
authorLennart Poettering <lennart@poettering.net>
Fri, 22 Mar 2019 18:21:48 +0000 (19:21 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 25 Mar 2019 12:48:53 +0000 (13:48 +0100)
src/core/dbus-unit.c

index 28ae6070a60d0a0cbd8ec184d99322e6ebbbe2f6..0afa9e23c00973c201705c9d4bf75abb3afba338 100644 (file)
@@ -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,