]> git.puffer.fish Git - mirror/frr.git/commit
zebra: Fix compilation warning 16603/head
authorCarmine Scarpitta <cscarpit@cisco.com>
Sun, 18 Aug 2024 11:02:06 +0000 (13:02 +0200)
committerCarmine Scarpitta <cscarpit@cisco.com>
Sun, 18 Aug 2024 11:03:04 +0000 (13:03 +0200)
commit354f9e9009326d695edf4b39d6fcc5feb9f3e8cf
tree183f8e9ad6d45256e5bb1214746b735cec580127
parent075899dee063a690219c0d3e7c2d4d05136cac08
zebra: Fix compilation warning

Make sure the variable `srv6` is not NULL before dereferencing it.

Fixes the following compilation warnings:

```
error 15-Aug-2024 14:20:01 zebra/zebra_srv6_vty.c:974:8: warning: Access to field 'locators' results in a dereference of a null pointer (loaded from variable 'srv6') [core.NullDereference]
error 15-Aug-2024 14:20:01                 for (ALL_LIST_ELEMENTS_RO(srv6->locators, node, locator)) {
error 15-Aug-2024 14:20:01                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error 15-Aug-2024 14:20:01 ./lib/linklist.h:345:11: note: expanded from macro 'ALL_LIST_ELEMENTS_RO'
error 15-Aug-2024 14:20:01         (node) = listhead(list), ((data) = NULL);                              \
error 15-Aug-2024 14:20:01                  ^~~~~~~~~~~~~~
error 15-Aug-2024 14:20:01 ./lib/linklist.h:63:22: note: expanded from macro 'listhead'
error 15-Aug-2024 14:20:01 #define listhead(X) ((X) ? ((X)->head) : NULL)
error 15-Aug-2024 14:20:01                      ^
```

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
zebra/zebra_srv6_vty.c