summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/automount.c6
-rw-r--r--src/core/dbus.c9
-rw-r--r--src/core/device.c3
-rw-r--r--src/core/execute.c38
-rw-r--r--src/core/load-fragment.c24
-rw-r--r--src/core/main.c3
-rw-r--r--src/core/swap.c3
-rw-r--r--src/core/unit.c6
-rw-r--r--src/libsystemd/sd-bus/bus-creds.c3
-rw-r--r--src/resolve/resolved-dns-zone.c7
-rw-r--r--src/resolve/resolved-link.c3
-rw-r--r--src/shared/path-lookup.c12
12 files changed, 37 insertions, 80 deletions
diff --git a/src/core/automount.c b/src/core/automount.c
index 5bb61b95d3..c88e3311bc 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -129,10 +129,8 @@ static void automount_done(Unit *u) {
a->where = mfree(a->where);
- set_free(a->tokens);
- a->tokens = NULL;
- set_free(a->expire_tokens);
- a->expire_tokens = NULL;
+ a->tokens = set_free(a->tokens);
+ a->expire_tokens = set_free(a->expire_tokens);
a->expire_event_source = sd_event_source_unref(a->expire_event_source);
}
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 0a2180c6a7..2d6a1ff836 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -1055,12 +1055,10 @@ void bus_done(Manager *m) {
while ((b = set_steal_first(m->private_buses)))
destroy_bus(m, &b);
- set_free(m->private_buses);
- m->private_buses = NULL;
+ m->private_buses = set_free(m->private_buses);
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 +1189,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/device.c b/src/core/device.c
index 7fdfacfddf..0b54518691 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -594,8 +594,7 @@ static void device_shutdown(Manager *m) {
m->udev_monitor = NULL;
}
- hashmap_free(m->devices_by_sysfs);
- m->devices_by_sysfs = NULL;
+ m->devices_by_sysfs = hashmap_free(m->devices_by_sysfs);
}
static int device_enumerate(Manager *m) {
diff --git a/src/core/execute.c b/src/core/execute.c
index 6abb0a5d5d..d1acda6682 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);
@@ -2034,17 +2025,11 @@ void exec_context_done(ExecContext *c) {
c->selinux_context = mfree(c->selinux_context);
c->apparmor_profile = mfree(c->apparmor_profile);
- set_free(c->syscall_filter);
- c->syscall_filter = NULL;
+ c->syscall_filter = set_free(c->syscall_filter);
+ c->syscall_archs = set_free(c->syscall_archs);
+ c->address_families = set_free(c->address_families);
- set_free(c->syscall_archs);
- c->syscall_archs = NULL;
-
- 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 +2064,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..3b02cd8085 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;
}
@@ -2305,8 +2302,7 @@ int config_parse_syscall_filter(
if (isempty(rvalue)) {
/* Empty assignment resets the list */
- set_free(c->syscall_filter);
- c->syscall_filter = NULL;
+ c->syscall_filter = set_free(c->syscall_filter);
c->syscall_whitelist = false;
return 0;
}
@@ -2404,8 +2400,7 @@ int config_parse_syscall_archs(
int r;
if (isempty(rvalue)) {
- set_free(*archs);
- *archs = NULL;
+ *archs = set_free(*archs);
return 0;
}
@@ -2501,8 +2496,7 @@ int config_parse_address_families(
if (isempty(rvalue)) {
/* Empty assignment resets the list */
- set_free(c->address_families);
- c->address_families = NULL;
+ c->address_families = set_free(c->address_families);
c->address_families_whitelist = false;
return 0;
}
@@ -3011,8 +3005,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 +3133,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/main.c b/src/core/main.c
index be95dc68b2..c9657505c3 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1846,8 +1846,7 @@ finish:
arg_default_environment = strv_free(arg_default_environment);
- set_free(arg_syscall_archs);
- arg_syscall_archs = NULL;
+ arg_syscall_archs = set_free(arg_syscall_archs);
mac_selinux_finish();
diff --git a/src/core/swap.c b/src/core/swap.c
index 311ce7ee04..bef457069f 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -1254,8 +1254,7 @@ static void swap_shutdown(Manager *m) {
m->proc_swaps = safe_fclose(m->proc_swaps);
- hashmap_free(m->swaps_by_devnode);
- m->swaps_by_devnode = NULL;
+ m->swaps_by_devnode = hashmap_free(m->swaps_by_devnode);
}
static int swap_enumerate(Manager *m) {
diff --git a/src/core/unit.c b/src/core/unit.c
index 24a6747b10..e40ea24be8 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) {
@@ -674,8 +673,7 @@ static void merge_dependencies(Unit *u, Unit *other, const char *other_id, UnitD
/* The move cannot fail. The caller must have performed a reservation. */
assert_se(complete_move(&u->dependencies[d], &other->dependencies[d]) == 0);
- set_free(other->dependencies[d]);
- other->dependencies[d] = NULL;
+ other->dependencies[d] = set_free(other->dependencies[d]);
}
int unit_merge(Unit *u, Unit *other) {
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index 6826e21665..3e8cb0b7d0 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -109,8 +109,7 @@ _public_ sd_bus_creds *sd_bus_creds_unref(sd_bus_creds *c) {
c->supplementary_gids = mfree(c->supplementary_gids);
- strv_free(c->well_known_names);
- c->well_known_names = NULL;
+ c->well_known_names = strv_free(c->well_known_names);
bus_creds_done(c);
diff --git a/src/resolve/resolved-dns-zone.c b/src/resolve/resolved-dns-zone.c
index 674bb6af28..8a59bd1c3c 100644
--- a/src/resolve/resolved-dns-zone.c
+++ b/src/resolve/resolved-dns-zone.c
@@ -90,11 +90,8 @@ void dns_zone_flush(DnsZone *z) {
assert(hashmap_size(z->by_key) == 0);
assert(hashmap_size(z->by_name) == 0);
- hashmap_free(z->by_key);
- z->by_key = NULL;
-
- hashmap_free(z->by_name);
- z->by_name = NULL;
+ z->by_key = hashmap_free(z->by_key);
+ z->by_name = hashmap_free(z->by_name);
}
static DnsZoneItem* dns_zone_get(DnsZone *z, DnsResourceRecord *rr) {
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c
index 47f461a37d..b9fd8e3dbc 100644
--- a/src/resolve/resolved-link.c
+++ b/src/resolve/resolved-link.c
@@ -238,8 +238,7 @@ static int link_update_domains(Link *l) {
if (!l->unicast_scope)
return 0;
- strv_free(l->unicast_scope->domains);
- l->unicast_scope->domains = NULL;
+ l->unicast_scope->domains = strv_free(l->unicast_scope->domains);
r = sd_network_link_get_domains(l->ifindex,
&l->unicast_scope->domains);
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index f6a127174c..d803bbe07e 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -333,8 +333,7 @@ int lookup_paths_init(
log_debug("Looking for unit files in (higher priority first):\n\t%s", t);
} else {
log_debug("Ignoring unit files.");
- strv_free(p->unit_path);
- p->unit_path = NULL;
+ p->unit_path = strv_free(p->unit_path);
}
if (running_as == MANAGER_SYSTEM) {
@@ -390,8 +389,7 @@ int lookup_paths_init(
log_debug("Looking for SysV init scripts in:\n\t%s", t);
} else {
log_debug("Ignoring SysV init scripts.");
- strv_free(p->sysvinit_path);
- p->sysvinit_path = NULL;
+ p->sysvinit_path = strv_free(p->sysvinit_path);
}
if (!strv_isempty(p->sysvrcnd_path)) {
@@ -403,8 +401,7 @@ int lookup_paths_init(
log_debug("Looking for SysV rcN.d links in:\n\t%s", t);
} else {
log_debug("Ignoring SysV rcN.d links.");
- strv_free(p->sysvrcnd_path);
- p->sysvrcnd_path = NULL;
+ p->sysvrcnd_path = strv_free(p->sysvrcnd_path);
}
#else
log_debug("SysV init scripts and rcN.d links support disabled");
@@ -417,8 +414,7 @@ int lookup_paths_init(
void lookup_paths_free(LookupPaths *p) {
assert(p);
- strv_free(p->unit_path);
- p->unit_path = NULL;
+ p->unit_path = strv_free(p->unit_path);
#ifdef HAVE_SYSV_COMPAT
strv_free(p->sysvinit_path);