]> git.proxmox.com Git - mirror_frr.git/blobdiff - ldpd/lde_lib.c
Merge pull request #3069 from donaldsharp/bgp_nexthop_address
[mirror_frr.git] / ldpd / lde_lib.c
index c56b7e33d096c56acddc49719fe99eb0915aceb1..28e455c7a58fc7009c64e6b96a0d9f76ed4d872d 100644 (file)
@@ -129,7 +129,9 @@ fec_clear(struct fec_tree *fh, void (*free_cb)(void *))
 {
        struct fec      *f;
 
-       while ((f = RB_ROOT(fec_tree, fh)) != NULL) {
+       while (!RB_EMPTY(fec_tree, fh)) {
+               f = RB_ROOT(fec_tree, fh);
+
                fec_remove(fh, f);
                free_cb(f);
        }
@@ -229,8 +231,10 @@ fec_free(void *arg)
        struct fec_node *fn = arg;
        struct fec_nh   *fnh;
 
-       while ((fnh = LIST_FIRST(&fn->nexthops)))
+       while ((fnh = LIST_FIRST(&fn->nexthops))) {
                fec_nh_del(fnh);
+               assert(fnh != LIST_FIRST(&fn->nexthops));
+       }
        if (!RB_EMPTY(lde_map_head, &fn->downstream))
                log_warnx("%s: fec %s downstream list not empty", __func__,
                    log_fec(&fn->fec));