]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: fix SA warning in typesafe code
authorMark Stapp <mstapp@nvidia.com>
Tue, 5 Jul 2022 20:31:41 +0000 (16:31 -0400)
committerMark Stapp <mstapp@nvidia.com>
Tue, 5 Jul 2022 20:31:41 +0000 (16:31 -0400)
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>
lib/typesafe.h

index 06fdc52e78ead3da1a2bedf44e050612dda9928d..df963f530d3d3af7a21ff1bf2a10934295cb4e1a 100644 (file)
@@ -309,7 +309,8 @@ static inline void typesafe_dlist_add(struct dlist_head *head,
                struct dlist_item *prev, struct dlist_item *item)
 {
        item->next = prev->next;
-       item->next->prev = item;
+       if (item->next)
+               item->next->prev = item;
        item->prev = prev;
        prev->next = item;
        head->count++;