summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTopi Miettinen <toiwoton@gmail.com>2020-01-02 18:59:48 +0100
committerRonny Chevalier <chevalier.ronny@gmail.com>2020-01-04 10:47:28 +0100
commitec04aef44225ab0b833b427b43ce8ab69385716d (patch)
tree6cac9978d740885fd2e436b2535136cb63d2b0d1
parenttest: use symlinks for Makefiles (diff)
downloadsystemd-ec04aef44225ab0b833b427b43ce8ab69385716d.tar.xz
systemd-ec04aef44225ab0b833b427b43ce8ab69385716d.zip
dbus-execute: avoid extra strdup()
bind_mount_add does the strdup(), so we can avoid strdup()ing the strings.
-rw-r--r--src/core/dbus-execute.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 1d0bc1ede3..c6772ba843 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -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,