From a1e58e8ee1c84b633d6d6d651d5328d4dd4eba5b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 8 Sep 2015 18:43:11 +0200 Subject: tree-wide: use coccinelle to patch a lot of code to use mfree() This replaces this: free(p); p = NULL; by this: p = mfree(p); Change generated using coccinelle. Semantic patch is added to the sources. --- src/hostname/hostnamed.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/hostname') diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index e90ae54156..e1ce2e6b31 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -64,8 +64,7 @@ static void context_reset(Context *c) { assert(c); for (p = 0; p < _PROP_MAX; p++) { - free(c->data[p]); - c->data[p] = NULL; + c->data[p] = mfree(c->data[p]); } } @@ -498,8 +497,7 @@ static int method_set_static_hostname(sd_bus_message *m, void *userdata, sd_bus_ return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ if (isempty(name)) { - free(c->data[PROP_STATIC_HOSTNAME]); - c->data[PROP_STATIC_HOSTNAME] = NULL; + c->data[PROP_STATIC_HOSTNAME] = mfree(c->data[PROP_STATIC_HOSTNAME]); } else { char *h; @@ -570,8 +568,7 @@ static int set_machine_info(Context *c, sd_bus_message *m, int prop, sd_bus_mess return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ if (isempty(name)) { - free(c->data[prop]); - c->data[prop] = NULL; + c->data[prop] = mfree(c->data[prop]); } else { char *h; -- cgit v1.2.3