1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-30 06:25:25 +03:00

sd-bus: make use of free_and_strdup() where it makes sense

This commit is contained in:
Lennart Poettering 2014-11-04 16:58:15 +01:00
parent 9cbfc66c62
commit d1b91c99d9

View File

@ -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) {