summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2012-04-20 10:21:37 +0200
committerMichal Schmidt <mschmidt@redhat.com>2012-04-20 17:12:27 +0200
commit97e7d748d1bf26790fc3b2607885f4ac8c4ecf3a (patch)
treebbabe2eb9589c28da467ba4e0d510ac7cd65e98f /src/core/unit.c
parent121b3b318042b7fd67ac96601971c1c2f9b77be5 (diff)
job: job_uninstall()
Split the uninstallation of the job from job_free() into a separate function. Adjust the callers. job_free() now only works on unlinked and uninstalled jobs. This enforces clear thinking about job lifetimes.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index df79fe3a69..ed3f176393 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -352,8 +352,11 @@ void unit_free(Unit *u) {
SET_FOREACH(t, u->names, i)
hashmap_remove_value(u->manager->units, t, u);
- if (u->job)
- job_free(u->job);
+ if (u->job) {
+ Job *j = u->job;
+ job_uninstall(j);
+ job_free(j);
+ }
for (d = 0; d < _UNIT_DEPENDENCY_MAX; d++)
bidi_set_free(u, u->dependencies[d]);