lib: fix SA warning in typesafe code

There's a nagging SA warning, at least with the scan-build
version we use in the FRR CI.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
This commit is contained in:
Mark Stapp 2022-07-05 16:31:41 -04:00
parent 211f1157ee
commit f580074e61

View File

@ -309,7 +309,8 @@ static inline void typesafe_dlist_add(struct dlist_head *head,
struct dlist_item *prev, struct dlist_item *item) struct dlist_item *prev, struct dlist_item *item)
{ {
item->next = prev->next; item->next = prev->next;
item->next->prev = item; if (item->next)
item->next->prev = item;
item->prev = prev; item->prev = prev;
prev->next = item; prev->next = item;
head->count++; head->count++;