chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
service: optionally call into PAM when dropping priviliges
[elogind.git]
/
src
/
unit.c
diff --git
a/src/unit.c
b/src/unit.c
index 695044a77f33e9a5e54069bac3fdee518c6cf6a8..229f44c1a97459e17152bca68845bf62af344382 100644
(file)
--- a/
src/unit.c
+++ b/
src/unit.c
@@
-323,10
+323,15
@@
void unit_free(Unit *u) {
if (UNIT_VTABLE(u)->done)
UNIT_VTABLE(u)->done(u);
if (UNIT_VTABLE(u)->done)
UNIT_VTABLE(u)->done(u);
- /* Detach from next 'bigger' objects */
SET_FOREACH(t, u->meta.names, i)
hashmap_remove_value(u->meta.manager->units, t, u);
SET_FOREACH(t, u->meta.names, i)
hashmap_remove_value(u->meta.manager->units, t, u);
+ if (u->meta.job)
+ job_free(u->meta.job);
+
+ for (d = 0; d < _UNIT_DEPENDENCY_MAX; d++)
+ bidi_set_free(u, u->meta.dependencies[d]);
+
if (u->meta.type != _UNIT_TYPE_INVALID)
LIST_REMOVE(Meta, units_per_type, u->meta.manager->units_per_type[u->meta.type], &u->meta);
if (u->meta.type != _UNIT_TYPE_INVALID)
LIST_REMOVE(Meta, units_per_type, u->meta.manager->units_per_type[u->meta.type], &u->meta);
@@
-344,21
+349,12
@@
void unit_free(Unit *u) {
u->meta.manager->n_in_gc_queue--;
}
u->meta.manager->n_in_gc_queue--;
}
- /* Free data and next 'smaller' objects */
- if (u->meta.job)
- job_free(u->meta.job);
-
cgroup_bonding_free_list(u->meta.cgroup_bondings);
cgroup_bonding_free_list(u->meta.cgroup_bondings);
- for (d = 0; d < _UNIT_DEPENDENCY_MAX; d++)
- bidi_set_free(u, u->meta.dependencies[d]);
-
free(u->meta.description);
free(u->meta.fragment_path);
free(u->meta.description);
free(u->meta.fragment_path);
- while ((t = set_steal_first(u->meta.names)))
- free(t);
- set_free(u->meta.names);
+ set_free_free(u->meta.names);
free(u->meta.instance);
free(u->meta.instance);
@@
-404,10
+400,7
@@
static void merge_names(Unit *u, Unit *other) {
complete_move(&u->meta.names, &other->meta.names);
complete_move(&u->meta.names, &other->meta.names);
- while ((t = set_steal_first(other->meta.names)))
- free(t);
-
- set_free(other->meta.names);
+ set_free_free(other->meta.names);
other->meta.names = NULL;
other->meta.id = NULL;
other->meta.names = NULL;
other->meta.id = NULL;