summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-10 04:43:21 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-10 18:00:20 +0200
commit3616a49cb0140ad1832ed861d9d9eb1ae632398e (patch)
tree7b13e1d775e90cfe830dd45707388d7e24ea2256
parent819e213fbfecbb09d8e61a5463d2fbf155fa67f9 (diff)
unit: free data from merged unit when we don't need it anymore
-rw-r--r--unit.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/unit.c b/unit.c
index fe502dbff2..d4f0538b36 100644
--- a/unit.c
+++ b/unit.c
@@ -424,11 +424,16 @@ int unit_merge(Unit *u, Unit *other) {
for (d = 0; d < _UNIT_DEPENDENCY_MAX; d++)
merge_dependencies(u, other, d);
- unit_add_to_dbus_queue(u);
-
other->meta.load_state = UNIT_MERGED;
other->meta.merged_into = u;
+ /* If there is still some data attached to the other node, we
+ * don't need it anymore, and can free it. */
+ if (other->meta.load_state != UNIT_STUB)
+ if (UNIT_VTABLE(other)->done)
+ UNIT_VTABLE(other)->done(other);
+
+ unit_add_to_dbus_queue(u);
unit_add_to_cleanup_queue(other);
return 0;