X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fcore%2Fpath.c;h=3775577bcf87031b27682f265536b858d040f8b6;hp=767620ba754bb2f42184c0acd42fe0a4e083cbf8;hb=74051b9b5865586bf4d30b9075649af838fb92bd;hpb=4b20075e2fbd99caee8b6a782050969a087a1a21;ds=sidebyside diff --git a/src/core/path.c b/src/core/path.c index 767620ba7..3775577bc 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;