diff options
Diffstat (limited to 'src/core/path.c')
-rw-r--r-- | src/core/path.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/core/path.c b/src/core/path.c index 767620ba75..3775577bcf 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -248,22 +248,28 @@ static void path_init(Unit *u) { p->directory_mode = 0755; } -static void path_done(Unit *u) { - Path *p = PATH(u); +void path_free_specs(Path *p) { PathSpec *s; assert(p); - unit_ref_unset(&p->unit); - while ((s = p->specs)) { - path_spec_unwatch(s, u); + path_spec_unwatch(s, UNIT(p)); LIST_REMOVE(PathSpec, spec, p->specs, s); path_spec_done(s); free(s); } } +static void path_done(Unit *u) { + Path *p = PATH(u); + + assert(p); + + unit_ref_unset(&p->unit); + path_free_specs(p); +} + int path_add_one_mount_link(Path *p, Mount *m) { PathSpec *s; int r; |