lib: Clean up delete of a nexthop from a nexthop group

The delete was not properly deleting the nexthop from
the nexthop group and it was not properly setting the
nexthop's pointers to NULL.

Ticket: CM-20261
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2018-03-28 19:31:40 -04:00
parent cafec8da4f
commit ebee2bc4c5

View file

@ -112,6 +112,9 @@ void nexthop_del(struct nexthop_group *nhg, struct nexthop *nh)
if (nexthop->next)
nexthop->next->prev = nexthop->prev;
nh->prev = NULL;
nh->next = NULL;
}
void copy_nexthops(struct nexthop **tnh, struct nexthop *nh,
@ -151,6 +154,7 @@ static void nhgc_delete_nexthops(struct nexthop_group_cmd *nhgc)
while (nexthop) {
struct nexthop *next = nexthop_next(nexthop);
nexthop_del(&nhgc->nhg, nexthop);
if (nhg_hooks.del_nexthop)
nhg_hooks.del_nexthop(nhgc, nexthop);