summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-09 23:05:10 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-09 23:05:58 +0200
commit6796073e330f49923c5134652ee085e29fc88002 (patch)
tree74846808a3d75996ef72fa305a54c62de6f2c5f0 /src/core
parent1d1423257aa7d486e1affc7495fce83438226245 (diff)
tree-wide: make use of the fact that strv_free() returns NULL
Another Coccinelle patch.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/dbus.c6
-rw-r--r--src/core/execute.c27
-rw-r--r--src/core/load-fragment.c15
-rw-r--r--src/core/unit.c3
4 files changed, 16 insertions, 35 deletions
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 0a2180c6a7..dcaf7cc835 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -1059,8 +1059,7 @@ void bus_done(Manager *m) {
m->private_buses = NULL;
m->subscribed = sd_bus_track_unref(m->subscribed);
- strv_free(m->deserialized_subscribed);
- m->deserialized_subscribed = NULL;
+ m->deserialized_subscribed = strv_free(m->deserialized_subscribed);
if (m->private_listen_event_source)
m->private_listen_event_source = sd_event_source_unref(m->private_listen_event_source);
@@ -1191,8 +1190,7 @@ int bus_track_coldplug(Manager *m, sd_bus_track **t, char ***l) {
}
}
- strv_free(*l);
- *l = NULL;
+ *l = strv_free(*l);
return r;
}
diff --git a/src/core/execute.c b/src/core/execute.c
index 6abb0a5d5d..86c2a80673 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1992,11 +1992,8 @@ void exec_context_done(ExecContext *c) {
assert(c);
- strv_free(c->environment);
- c->environment = NULL;
-
- strv_free(c->environment_files);
- c->environment_files = NULL;
+ c->environment = strv_free(c->environment);
+ c->environment_files = strv_free(c->environment_files);
for (l = 0; l < ELEMENTSOF(c->rlimit); l++)
c->rlimit[l] = mfree(c->rlimit[l]);
@@ -2008,8 +2005,7 @@ void exec_context_done(ExecContext *c) {
c->user = mfree(c->user);
c->group = mfree(c->group);
- strv_free(c->supplementary_groups);
- c->supplementary_groups = NULL;
+ c->supplementary_groups = strv_free(c->supplementary_groups);
c->pam_name = mfree(c->pam_name);
@@ -2018,14 +2014,9 @@ void exec_context_done(ExecContext *c) {
c->capabilities = NULL;
}
- strv_free(c->read_only_dirs);
- c->read_only_dirs = NULL;
-
- strv_free(c->read_write_dirs);
- c->read_write_dirs = NULL;
-
- strv_free(c->inaccessible_dirs);
- c->inaccessible_dirs = NULL;
+ c->read_only_dirs = strv_free(c->read_only_dirs);
+ c->read_write_dirs = strv_free(c->read_write_dirs);
+ c->inaccessible_dirs = strv_free(c->inaccessible_dirs);
if (c->cpuset)
CPU_FREE(c->cpuset);
@@ -2043,8 +2034,7 @@ void exec_context_done(ExecContext *c) {
set_free(c->address_families);
c->address_families = NULL;
- strv_free(c->runtime_directory);
- c->runtime_directory = NULL;
+ c->runtime_directory = strv_free(c->runtime_directory);
bus_endpoint_free(c->bus_endpoint);
c->bus_endpoint = NULL;
@@ -2079,8 +2069,7 @@ void exec_command_done(ExecCommand *c) {
c->path = mfree(c->path);
- strv_free(c->argv);
- c->argv = NULL;
+ c->argv = strv_free(c->argv);
}
void exec_command_done_array(ExecCommand *c, unsigned n) {
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index b695c57da8..79dd3075c9 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1888,8 +1888,7 @@ int config_parse_unit_env_file(const char *unit,
if (isempty(rvalue)) {
/* Empty assignment frees the list */
- strv_free(*env);
- *env = NULL;
+ *env = strv_free(*env);
return 0;
}
@@ -1937,8 +1936,7 @@ int config_parse_environ(const char *unit,
if (isempty(rvalue)) {
/* Empty assignment resets the list */
- strv_free(*env);
- *env = NULL;
+ *env = strv_free(*env);
return 0;
}
@@ -2245,8 +2243,7 @@ int config_parse_documentation(const char *unit,
if (isempty(rvalue)) {
/* Empty assignment resets the list */
- strv_free(u->documentation);
- u->documentation = NULL;
+ u->documentation = strv_free(u->documentation);
return 0;
}
@@ -3011,8 +3008,7 @@ int config_parse_runtime_directory(
if (isempty(rvalue)) {
/* Empty assignment resets the list */
- strv_free(*rt);
- *rt = NULL;
+ *rt = strv_free(*rt);
return 0;
}
@@ -3140,8 +3136,7 @@ int config_parse_namespace_path_strv(
if (isempty(rvalue)) {
/* Empty assignment resets the list */
- strv_free(*sv);
- *sv = NULL;
+ *sv = strv_free(*sv);
return 0;
}
diff --git a/src/core/unit.c b/src/core/unit.c
index 24a6747b10..563d7bf254 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -445,8 +445,7 @@ static void unit_free_requires_mounts_for(Unit *u) {
}
}
- strv_free(u->requires_mounts_for);
- u->requires_mounts_for = NULL;
+ u->requires_mounts_for = strv_free(u->requires_mounts_for);
}
static void unit_done(Unit *u) {