diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-06-05 02:16:20 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-06-05 02:16:20 +0200 |
commit | 964e0949dd35ecc3fd908de7898b01ab37a13bbb (patch) | |
tree | 9d592204d25c4479fa363be050b3b9b5e36bfd31 /src/unit.c | |
parent | 27ca8d7a250915b290cf89c195e383a8abab35d5 (diff) |
unit: when destructing units make sure we don't readd the unit to the gc queue after we already removed it there
Diffstat (limited to 'src/unit.c')
-rw-r--r-- | src/unit.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/unit.c b/src/unit.c index 695044a77f..3bb41a4239 100644 --- 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); - /* Detach from next 'bigger' objects */ 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); @@ -344,15 +349,8 @@ void unit_free(Unit *u) { 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); - 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); |