hostnamed: modernizations

This commit is contained in:
Lennart Poettering 2013-11-21 19:32:33 +01:00
parent 9d5a3757c3
commit 0ccad099d4
1 changed files with 5 additions and 9 deletions

View File

@ -266,7 +266,7 @@ static int context_write_data_other(Context *c) {
[PROP_CHASSIS] = "CHASSIS" [PROP_CHASSIS] = "CHASSIS"
}; };
char **l = NULL; _cleanup_strv_free_ char **l = NULL;
int r, p; int r, p;
assert(c); assert(c);
@ -285,17 +285,16 @@ static int context_write_data_other(Context *c) {
continue; continue;
} }
if (asprintf(&t, "%s=%s", name[p], strempty(c->data[p])) < 0) { if (asprintf(&t, "%s=%s", name[p], strempty(c->data[p])) < 0)
strv_free(l);
return -ENOMEM; return -ENOMEM;
}
u = strv_env_set(l, t); u = strv_env_set(l, t);
free(t); free(t);
strv_free(l);
if (!u) if (!u)
return -ENOMEM; return -ENOMEM;
strv_free(l);
l = u; l = u;
} }
@ -307,10 +306,7 @@ static int context_write_data_other(Context *c) {
return 0; return 0;
} }
r = write_env_file_label("/etc/machine-info", l); return write_env_file_label("/etc/machine-info", l);
strv_free(l);
return r;
} }
static int property_get_icon_name( static int property_get_icon_name(