]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dbus-execute: avoid extra strdup()
authorTopi Miettinen <toiwoton@gmail.com>
Thu, 2 Jan 2020 17:59:48 +0000 (19:59 +0200)
committerRonny Chevalier <chevalier.ronny@gmail.com>
Sat, 4 Jan 2020 09:47:28 +0000 (10:47 +0100)
bind_mount_add does the strdup(), so we can avoid
strdup()ing the strings.

src/core/dbus-execute.c

index 1d0bc1ede3cb538753d1adf654b9e11da16e8030..c6772ba843160968c314d4dbadcba1017f99de23 100644 (file)
@@ -2379,7 +2379,7 @@ int bus_exec_context_set_transient_property(
                 return 1;
 
         } else if (STR_IN_SET(name, "BindPaths", "BindReadOnlyPaths")) {
-                const char *source, *destination;
+                char *source, *destination;
                 int ignore_enoent;
                 uint64_t mount_flags;
                 bool empty = true;
@@ -2400,8 +2400,8 @@ int bus_exec_context_set_transient_property(
                         if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
                                 r = bind_mount_add(&c->bind_mounts, &c->n_bind_mounts,
                                                    &(BindMount) {
-                                                           .source = strdup(source),
-                                                           .destination = strdup(destination),
+                                                           .source = source,
+                                                           .destination = destination,
                                                            .read_only = !!strstr(name, "ReadOnly"),
                                                            .recursive = !!(mount_flags & MS_REC),
                                                            .ignore_enoent = ignore_enoent,