diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-12-11 20:30:07 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-12-14 10:46:19 +0100 |
commit | 8d3b9edc6b2a56a0efbbbdf099b45d004fa4e24f (patch) | |
tree | 3aa544145b9b45fe28b10815e3f0448b0087ab24 /src/busctl | |
parent | 35bbbf85e01372cc5091fa5fbf3ca83e262de90d (diff) | |
download | systemd-8d3b9edc6b2a56a0efbbbdf099b45d004fa4e24f.tar.gz systemd-8d3b9edc6b2a56a0efbbbdf099b45d004fa4e24f.tar.bz2 systemd-8d3b9edc6b2a56a0efbbbdf099b45d004fa4e24f.zip |
busctl: modernize code a bit
I am puzzled why coccinelle is unwilling to detect these cases...
Diffstat (limited to 'src/busctl')
-rw-r--r-- | src/busctl/busctl.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c index 81140f9d36..2e92514c4b 100644 --- a/src/busctl/busctl.c +++ b/src/busctl/busctl.c @@ -956,18 +956,14 @@ static int introspect(sd_bus *bus, char **argv) { if (r < 0) return bus_log_parse_error(r); - fclose(mf); - mf = NULL; + mf = safe_fclose(mf); z = set_get(members, &((Member) { .type = "property", .interface = m->interface, .name = (char*) name })); - if (z) { - free(z->value); - z->value = buf; - buf = NULL; - } + if (z) + free_and_replace(z->value, buf); r = sd_bus_message_exit_container(reply); if (r < 0) |