diff options
author | Daniel Mack <github@zonque.org> | 2015-09-09 09:57:29 +0200 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-09-09 09:57:29 +0200 |
commit | 0fa7d1f5be847d4804eb3bf6a4c10333ea14e0bc (patch) | |
tree | 6afb70cc560bd94219f81495ff699c83b404e18c /src/hostname/hostnamed.c | |
parent | bed2c013b6570908a114a337632000cf9c9de838 (diff) | |
parent | ece174c5439021e32ebcc858842de9586072c006 (diff) |
Merge pull request #1207 from poettering/coccinelle-fixes
Coccinelle fixes
Diffstat (limited to 'src/hostname/hostnamed.c')
-rw-r--r-- | src/hostname/hostnamed.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index e90ae54156..cb837e9d03 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]); } } @@ -114,12 +113,11 @@ static int context_read_data(Context *c) { "PRETTY_NAME", &c->data[PROP_OS_PRETTY_NAME], "CPE_NAME", &c->data[PROP_OS_CPE_NAME], NULL); - if (r == -ENOENT) { + if (r == -ENOENT) r = parse_env_file("/usr/lib/os-release", NEWLINE, "PRETTY_NAME", &c->data[PROP_OS_PRETTY_NAME], "CPE_NAME", &c->data[PROP_OS_CPE_NAME], NULL); - } if (r < 0 && r != -ENOENT) return r; @@ -498,8 +496,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 +567,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; |