config: use list safe iterator in lease_delete
authorHans Dedecker <dedeckeh@gmail.com>
Tue, 14 May 2019 13:18:08 +0000 (15:18 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Tue, 14 May 2019 13:22:02 +0000 (15:22 +0200)
As the current assignment is freed in lease_delete use list_for_each_entry_safe

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/config.c

index f1fe82b3312ac7cf2adf3747959e4f7788a06447..40f18a4b27371f538ccd884d7cb07d505bf88734 100644 (file)
@@ -881,9 +881,9 @@ static void lease_change_config(struct lease *l_old, struct lease *l_new)
 
 static void lease_delete(struct lease *l)
 {
-       struct dhcp_assignment *a;
+       struct dhcp_assignment *a, *tmp;
 
-       list_for_each_entry(a, &l->assignments, lease_list)
+       list_for_each_entry_safe(a, tmp, &l->assignments, lease_list)
                free_assignment(a);
 
        free_lease(l);