summaryrefslogtreecommitdiff
path: root/src/busctl
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-11 20:30:07 +0100
committerLennart Poettering <lennart@poettering.net>2017-12-14 10:46:19 +0100
commit8d3b9edc6b2a56a0efbbbdf099b45d004fa4e24f (patch)
tree3aa544145b9b45fe28b10815e3f0448b0087ab24 /src/busctl
parent35bbbf85e01372cc5091fa5fbf3ca83e262de90d (diff)
downloadsystemd-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.c10
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)