diff --git a/src/core/unit.c b/src/core/unit.c index 2205ad0e2b..8684471d57 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -1195,6 +1195,8 @@ int unit_merge(Unit *u, Unit *other) { if (r < 0) return r; + UnitLoadState saved_load_state = other->load_state; + other->load_state = UNIT_MERGED; other->merged_into = u; @@ -1203,7 +1205,7 @@ int unit_merge(Unit *u, Unit *other) { /* If there is still some data attached to the other node, we * don't need it anymore, and can free it. */ - if (other->load_state != UNIT_STUB) + if (saved_load_state != UNIT_STUB) if (UNIT_VTABLE(other)->done) UNIT_VTABLE(other)->done(other);