diff options
Diffstat (limited to 'lib/nexthop_group.c')
-rw-r--r-- | lib/nexthop_group.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c index 0051cba62..d7aceb55b 100644 --- a/lib/nexthop_group.c +++ b/lib/nexthop_group.c @@ -250,8 +250,7 @@ static void _nexthop_add_sorted(struct nexthop **head, { struct nexthop *position, *prev; - /* Ensure this gets set */ - nexthop->next = NULL; + assert(!nexthop->next); for (position = *head, prev = NULL; position; prev = position, position = position->next) { @@ -281,6 +280,8 @@ void nexthop_group_add_sorted(struct nexthop_group *nhg, { struct nexthop *tail; + assert(!nexthop->next); + /* Try to just append to the end first; * trust the list is already sorted */ |