diff --git a/WHATS_NEW b/WHATS_NEW index e1c7182fd..07474e650 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.91 - =================================== + Use list functions for label_exit(). Ensure strncpy() function always ends with '\0'. Set status in _fsadm_cmd() for error path. Add missing deps for lvm2api for rebuild when lvm-internal is changed. diff --git a/lib/label/label.c b/lib/label/label.c index eb04ea359..f377367e1 100644 --- a/lib/label/label.c +++ b/lib/label/label.c @@ -56,11 +56,6 @@ static struct labeller_i *_alloc_li(const char *name, struct labeller *l) return li; } -static void _free_li(struct labeller_i *li) -{ - dm_free(li); -} - int label_init(void) { dm_list_init(&_labellers); @@ -69,14 +64,12 @@ int label_init(void) void label_exit(void) { - struct dm_list *c, *n; - struct labeller_i *li; + struct labeller_i *li, *tli; - for (c = _labellers.n; c && c != &_labellers; c = n) { - n = c->n; - li = dm_list_item(c, struct labeller_i); + dm_list_iterate_items_safe(li, tli, &_labellers) { + dm_list_del(&li->list); li->l->ops->destroy(li->l); - _free_li(li); + dm_free(li); } dm_list_init(&_labellers);