summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/sd-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-04 16:58:15 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-04 18:09:19 +0100
commitd1b91c99d9241f7f79756a42f845cf35992888cd (patch)
tree47f84283c38ac37fea3b17c4a5d2e56c1a7f5950 /src/libsystemd/sd-bus/sd-bus.c
parent9cbfc66c621c42aa6e58e9e0da0adfb01efa7537 (diff)
sd-bus: make use of free_and_strdup() where it makes sense
Diffstat (limited to 'src/libsystemd/sd-bus/sd-bus.c')
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 251720a6ba..ba8d5e60fb 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -324,21 +324,12 @@ _public_ int sd_bus_set_trusted(sd_bus *bus, int b) {
}
_public_ int sd_bus_set_description(sd_bus *bus, const char *description) {
- char *n;
-
assert_return(bus, -EINVAL);
assert_return(description, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
- n = strdup(description);
- if (!n)
- return -ENOMEM;
-
- free(bus->description);
- bus->description = n;
-
- return 0;
+ return free_and_strdup(&bus->description, description);
}
static int hello_callback(sd_bus *bus, sd_bus_message *reply, void *userdata, sd_bus_error *error) {